title: Laravel 5.7 Login Error: These credentials don't match our records
body: <p>I'm very new to Laravel 5.7. I'm working on an assignment that requires a user to login in order to do CRUD functions. My CRUD is working fine, but I am having a problem with the login system. </p>
  
  <p>I'm using the default login from laravel (auth), and I can register and it logs me in. However, my problem is when I log out, I am unable to login again. The email field becomes red and it tells me</p>
  
  <p>" These credentials do not match our records."</p>
  
  <p>But it is exactly as it is in the database. I am using the default login and have not changed anything except for adding a logout function in the LoginController.</p>
  
  <p>I have tried searching google and here but have not found any answers. Does anyone know why this is happening and how to fix it?</p>
  
  <p>Edit:
  These are my codes:</p>
  
  <p>routes</p>
  
  <pre><code>Auth::routes();
  
  Route::get('/home', 'HomeController@index')-&gt;name('aboutinfo');
  
  Route::get('/logout', 'YourController@logout');
  
  </code></pre>
  
  <p>LoginController.php</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers\Auth;
  
  use App\Http\Controllers\Controller;
  use Illuminate\Foundation\Auth\AuthenticatesUsers;
  use Illuminate\Support\Facades\Hash;
  use Auth;
  use Redirect;
  use Session;
  use Validator;
  use Illuminate\Support\Facades\Input;
  use Illuminate\Http\Request;
  use Illuminate\Http\Response;
  
  class LoginController extends Controller
  {
      /*
      |--------------------------------------------------------------------------
      | Login Controller
      |--------------------------------------------------------------------------
      |
      | This controller handles authenticating users for the application and
      | redirecting them to your home screen. The controller uses a trait
      | to conveniently provide its functionality to your applications.
      |
      */
  
      use AuthenticatesUsers;
  
      /**
       * Where to redirect users after login.
       *
       * @var string
       */
      protected function authenticated() {
      if (Auth::check()) {
          return redirect()-&gt;route('aboutinfo');
      }
  }
  
      /**
       * Create a new controller instance.
       *
       * @return void
       */
      public function __construct()
      {
          $this-&gt;middleware('guest')-&gt;except('logout');
      }
  
      public function logout(Request $request)  {
          $this-&gt;guard()-&gt;logout();
  
          $request-&gt;session()-&gt;invalidate();
  
          return redirect('/');
   }
  }
  </code></pre>
  
  <p>login.blade.php</p>
  
  <pre><code>@extends('allayout')
  
  @section('content')
  &lt;div class="container"&gt;
      &lt;div class="row justify-content-center"&gt;
          &lt;div class="col-md-8"&gt;
              &lt;div class="card"&gt;
                  &lt;div class="card-header"&gt;{{ __('Login') }}&lt;/div&gt;
  
                  &lt;div class="card-body"&gt;
                      &lt;form method="POST" action="{{ route('login') }}"&gt;
                          @csrf
  
                          &lt;div class="form-group row"&gt;
                              &lt;label for="email" class="col-sm-4 col-form-label text-md-right"&gt;{{ __('E-Mail Address') }}&lt;/label&gt;
  
                              &lt;div class="col-md-6"&gt;
                                  &lt;input id="email" type="email" class="form-control{{ $errors-&gt;has('email') ? ' is-invalid' : '' }}" name="email" value="{{ old('email') }}" required autofocus&gt;
  
                                  @if ($errors-&gt;has('email'))
                                      &lt;span class="invalid-feedback" role="alert"&gt;
                                          &lt;strong&gt;{{ $errors-&gt;first('email') }}&lt;/strong&gt;
                                      &lt;/span&gt;
                                  @endif
                              &lt;/div&gt;
                          &lt;/div&gt;
  
                          &lt;div class="form-group row"&gt;
                              &lt;label for="password" class="col-md-4 col-form-label text-md-right"&gt;{{ __('Password') }}&lt;/label&gt;
  
                              &lt;div class="col-md-6"&gt;
                                  &lt;input id="password" type="password" class="form-control{{ $errors-&gt;has('password') ? ' is-invalid' : '' }}" name="password" required&gt;
  
                                  @if ($errors-&gt;has('password'))
                                      &lt;span class="invalid-feedback" role="alert"&gt;
                                          &lt;strong&gt;{{ $errors-&gt;first('password') }}&lt;/strong&gt;
                                      &lt;/span&gt;
                                  @endif
                              &lt;/div&gt;
                          &lt;/div&gt;
  
                          &lt;div class="form-group row"&gt;
                              &lt;div class="col-md-6 offset-md-4"&gt;
                                  &lt;div class="form-check"&gt;
                                      &lt;input class="form-check-input" type="checkbox" name="remember" id="remember" {{ old('remember') ? 'checked' : '' }}&gt;
  
                                      &lt;label class="form-check-label" for="remember"&gt;
                                          {{ __('Remember Me') }}
                                      &lt;/label&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
  
                          &lt;div class="form-group row mb-0"&gt;
                              &lt;div class="col-md-8 offset-md-4"&gt;
                                  &lt;button type="submit" class="btn btn-primary"&gt;
                                      {{ __('Login') }}
                                  &lt;/button&gt;
  
                                  &lt;a class="btn btn-link" href="{{ route('password.request') }}"&gt;
                                      {{ __('Forgot Your Password?') }}
                                  &lt;/a&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/form&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  @endsection
  </code></pre>
  
  <p>HomeController.php</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  
  class HomeController extends Controller
  {
      /**
       * Create a new controller instance.
       *
       * @return void
       */
      public function __construct()
      {
          $this-&gt;middleware('auth');
      }
  
      /**
       * Show the application dashboard.
       *
       * @return \Illuminate\Contracts\Support\Renderable
       */
      public function index()
      {
          return view('aboutinfo');
      }
  }
  </code></pre>
  
  <p>User.php</p>
  
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Notifications\Notifiable;
  use Illuminate\Contracts\Auth\MustVerifyEmail;
  use Illuminate\Foundation\Auth\User as Authenticatable;
  
  class User extends Authenticatable
  {
      use Notifiable;
  
      /**
       * The attributes that are mass assignable.
       *
       * @var array
       */
      protected $fillable = [
          'name', 'email', 'password',
      ];
  
      /**
       * The attributes that should be hidden for arrays.
       *
       * @var array
       */
      protected $hidden = [
          'password', 'remember_token',
      ];
  
      /**
       * The attributes that should be cast to native types.
       *
       * @var array
       */
      protected $casts = [
          'email_verified_at' =&gt; 'datetime',
      ];
  
      public $timestamps = false;
  
      /**
       * @return mixed|string
       */
      public function getAuthPassword()
      {
          return $this-&gt;user_password;
      }
  
      /**
       * @return string
       */
      public function getKey()
      {
          return $this-&gt;user_id;
      }
  
      protected $primaryKey = 'id';
  }
  
  
  </code></pre>
  
  <p>Is there anything that I've done wrong?</p>