I'm using Laravel 5.4. I know that hashing is one way thing. as I remembered, I hashed passwords and saved them on database and when i wanted to check user password I would hash their entered password and checked it with hashed string on database.
in laravel I only need to write below code:
$email = $request['email'];
$pass = $request['password'];
if(Auth::attempt(['email'=> $email , 'password' => $pass])){
//return something
}
There is no need to bcrypt($request['password']);
.
eventhough every time I have to use bcrypt
the hash string would be different.
How Auth::attempt
Hash password with bcrypt
for checking passwords.
I need an explanation that how Auth::attempt
works while using bcrypt
. I know how to implement the code and check passwords.
Auth::attempt
function ! So just check with that function – David Jaw Hpan