0
我面临Auth问题,我有管理中间件和处理函数,但Auth::check
总是返回false。看起来像用户会话不存在。Auth :: check()返回false Laravel 5.2
我认为问题出现在/storage
和/bootstrap/cache
的权限中,但是当我为这些文件夹设置777
时,问题仍然存在。会话文件夹不是空的。
我试图清除缓存。
我联系中间件:
public function handle($request, Closure $next)
{
//check the proper role
if (Auth::check() && Auth::user()->isAdmin()) {
return $next($request);
}
else {
return response()->view('auth.forbidden')->header('Content-Type', 'text/html');
}
}
什么想法?
感谢
是否使用自己的身份验证系统或Laravel的一个? –
自定义Laravel Auth,我刚添加了我的Admin中间件。在本地服务器上,一切正常。这个问题只在生产服务器上。 –
@zm_fans请显示您的中间件详细信息 –