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請顯示您的中間件詳細信息 –