How do I check if Bcrypt password is correct?
Use the attempt()
method:
if (Auth::attempt(['email' => $email, 'password' => $password]))
The
attempt
method accepts an array of key/value pairs as its first argument. The values in the array will be used to find the user in your database table.
https://laravel.com/docs/5.4/authentication#authenticating-users
Under the hood attempt()
uses password_verify()
method to check password.
You could also use the check
method of the Hash
Facade
if (Hash::check($request->password, $user->password)) { // The passwords match...}