一、如果要检查要验证的用户数据是否正确,可以使用:

if (Auth::validate($credentials))
{
    //
}

二、但是如果您想通过用户和密码从数据库中获取用户,您可以使用:

// laravel的魔术方法 
// whereName 查询 username 字段
// wherePassword 查询 password 字段
$user = User::whereName($request->input('username'))
->wherePassword(Hash::make($request->input('password')))
->first();

要在数据库中存储密码,你应该使用Hash::make($password),因为它显示它没有任何问题。使用Auth::validate可以解决问题。

相关文章:

  • 2022-12-23
  • 2021-12-25
  • 2021-05-16
  • 2021-08-01
  • 2021-12-03
  • 2021-04-30
  • 2022-01-02
  • 2022-02-28
猜你喜欢
  • 2021-10-01
  • 2021-09-27
  • 2022-01-03
  • 2021-11-01
  • 2022-12-23
  • 2021-12-23
  • 2021-05-21
相关资源
相似解决方案