Laravel Auth ::尝试总是返回false?

时间:2017-03-30 15:50:42

标签: laravel laravel-5

这是数据库和我的登录输入的myscreen镜头 enter image description here

foldTree f a (Leaf x) = f x a
foldTree f a (Node left right) = foldTree f (foldTree f a left) right

我正在尝试使用laravel public function action(Request $request){ $username = $request->username; $pass = bcrypt($request->password); $credentials = [ 'id' => $username, 'password' => $pass ]; dd(Auth::attempt($credentials)); if (Auth::attempt(['id' => $username, 'password' => $pass])) { echo 'Ok'; }else{ echo 'Not ok'; } 进行登录操作,但它始终返回auth::attempt

1 个答案:

答案 0 :(得分:3)

$pass = bcrypt($request->password);

应该是

$pass = $request->password;

attempt方法将自动处理加密和比较。您实际上已将其加密两次,因此未找到匹配项