title: Laravel 5.7 Custom Login Not Working - New Installation
body: <p>I have a new installation of laravel 5.7
  I have created the database and users table with dummy info manually and connected the database with the application. </p>
  
  <p>Can anyone please point out why the following code isn't working.</p>
  
  <p>login.blade.php
      </p>
  
  <pre><code>        &lt;div class="form box"&gt;
             &lt;h1 align="center"&gt;Login - MobileInfo&lt;/h1&gt;
             &lt;br /&gt;
  
             @if(isset(Auth::user()-&gt;username))
                  &lt;script&gt;window.location="main/success"&lt;/script&gt;
             @endif
  
             @if ($message = Session::get('error'))
             &lt;div class="alert alert-danger alert-block"&gt;
                 &lt;button type="button" class="close" data-dismiss="alert"&gt;x&lt;/button&gt;
                 &lt;strong&gt;{{ $message }}&lt;/strong&gt;
             &lt;/div&gt;
             @endif
  
             @if (count($errors) &gt; 0)
             &lt;div class="alert alert-danger"&gt;
                 &lt;ul&gt;
                     @foreach($errors-&gt;all() as $error)
                     &lt;li&gt;{{ $error }}&lt;/li&gt;
                     @endforeach
                 &lt;/ul&gt;
             &lt;/div&gt;
  
             @endif
              &lt;form method="post" action="{{ url('login/checklogin') }}"&gt;
                  {{ csrf_field()}}
                  &lt;div class="form-group"&gt;
                      &lt;label&gt;Username&lt;/label&gt;
                      &lt;input type="text" name="username" class="form-control" /&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      &lt;label&gt;Password&lt;/label&gt;
                      &lt;input type="password" name="password" class="form-control" /&gt;
                  &lt;/div&gt;
                   &lt;div class="form-group"&gt;
                      &lt;input type="submit" name="login" class="btn btn-primary" value="Login" /&gt;
                  &lt;/div&gt;
              &lt;/form&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>Login Controller </p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  use Validator;
  use Auth;
  
  class LoginController extends Controller
  {
  public function index()
  {
      return view ('login');
  }
  
  function checklogin(Request $request)
  {
      $this-&gt;validate($request, [
          'username' =&gt; 'required',
          'password' =&gt; 'required'
      ]);
  
      $user_data = array(
          'username' =&gt; $request-&gt;get('username'),
          'password' =&gt; $request-&gt;get('password')
      );
  
      if(Auth::attempt($user_data))
      {
          return redirect('login/success');
      }
      else
      {
          return back()-&gt;with('error', 'Wrong Login Details');
      }
  }
  
  function success()
  {
      return view('dashboard');
  }
  
  function logout()
  {
      Auth::logout();
      return redirect('login');
  }
  }
  </code></pre>
  
  <p>web.php</p>
  
  <pre><code>Route::get('/', 'LoginController@index');
  Route::post('login/checklogin', 'LoginController@checklogin');
  Route::get('login/success', 'LoginController@success');
  Route::get('login/logout', 'LoginController@logout');
  </code></pre>
  
  <p>The error I see after adding any of the correct combinations of username/password is the else block of Auth::attempt($user_data), that is "Wrong Login Details". </p>