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 : '/');
}
那么我做错了什么?注销在我的其他应用程序中一直运行正常,所以我想知道我无意中做了什么。