0
我使用Laravel 5.2,這是我的退出路線:Laravel退出路由重定向,但仍存在登錄
Route::get('/logout', [ 'uses' => 'Auth\[email protected]', 'as' => 'logout']);
當我瀏覽到/logout
我得到重定向回主頁,但我不明白登出。當我嘗試去保護的途徑,像這樣:
Route::get('/amIloggedout',['middleware' => 'auth',
'uses' => '[email protected]',
'as' => 'moms.Logout'
]);
它讓我的權利並通過控制器也傳遞一個告訴我,我登錄(顯示我的用戶名)的信息產生的看法。
該控制器是在這裏,我不認爲我無意中登錄自己回到自動:
public function firstPass()
{
if(Auth::user()->Type=="Employee" || Auth::user()->Type=="ADMIN")
{
//retrieve data or else echo ACCESS DENIED below
所以我不明白爲什麼它不工作?也許是因爲我使用用戶名而不是電子郵件登錄?但我看着@getLogout
函數它似乎並不在乎你如何登錄,它只是註銷。
public function getLogout()
{
return $this->logout();
}
/**
* Log the user out of the application.
*
* @return \Illuminate\Http\Response
*/
public function logout()
{
Auth::guard($this->getGuard())->logout();
return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/');
}
那麼我做錯了什麼?註銷在我的其他應用程序中一直運行正常,所以我想知道我無意中做了什麼。