2
嗨我试图实现注销。我还在用户表中添加了remember_token。它在我登录时得到更新,但我无法使用以下功能注销。有更多我需要添加注销?Laravel用户注销
public function doLogout(){
Auth::logout();
Session::forget('user');
return Redirect::to('/#signin');
}
嗨我试图实现注销。我还在用户表中添加了remember_token。它在我登录时得到更新,但我无法使用以下功能注销。有更多我需要添加注销?Laravel用户注销
public function doLogout(){
Auth::logout();
Session::forget('user');
return Redirect::to('/#signin');
}
试试这个,首先创建一个路由
Route::get('auth/logout', ['as' => 'auth.logout', 'uses' => 'Auth\[email protected]']);
然后添加一个链接,
<a href="{{ route('auth.logout') }}">Logout</a>
或重定向。
public function doLogout(){
return redirect()->route('auth.logout');
}
您可以检查这些文件,以更多的信息 http://laravel.com/docs/master/authentication#included-authenticating
这应该做的伎俩。它显示的错误是什么? –
我没有收到任何错误。我使用Auth :: check()在退出后检查用户是否已登录。我对这个值是真实的 –