As Hiren has mentioned you can use the default registered hasher as that is passed to the specific UserProvider used. The default is Illuminate\Hashing\BcryptHasher.
You can use it a couple of ways:
- Out of the container
$user = User::find($id);
$hasher = app('hash');
if ($hasher->check('passwordToCheck', $user->password)) {
// Success
}
- Using the Facade
$user = User::find($id);
if (Hash::check('passwordToCheck', $user->password)) {
// Success
}
- Out of interest using the generic php function
password_verifyalso works. However that works because the default hashing algorithm it uses is bcrypt.
if (password_verify('passwordToCheck', $user->password)) {
// Success
}