【发布时间】:2016-05-07 21:37:22
【问题描述】:
我遇到了 laravel 5.2 的问题,
public function authenticate()
{
$user = Auth::attempt(['email' => Input::get('email'), 'password' => Input::get('password')]);
if (Auth::check()) {
return redirect()->intended('default');
} else {
return 'wrong password or mail';
}
}
在 authenticate() 函数中,Auth::check() 为真。但是在我的 Authenticate Middleware 中它返回 false...
public function handle($request, Closure $next, $guard = null)
{
if (!Auth::check()) { //Here Auth::check() is false
return redirect()->guest('auth/login');
}
return $next($request);
}
我无法弄清楚问题是什么或我做错了什么...... 我尝试使用 Sessions,但两个数据都没有保留。
谢谢
【问题讨论】:
-
请查看this是否有帮助。
-
我已经检查过了,但没有帮助...
-
您的所有路由都需要在
web中间件组内进行身份验证/会话吗?
标签: php laravel authentication laravel-5.2