Laravel用户注销


Laravel User Logout

嗨,我试着实现注销。我还在用户表中添加了remember_token。当我登录时,它会更新,但我无法使用以下功能注销。我需要添加更多内容才能注销吗?

public function doLogout(){
  Auth::logout();
  Session::forget('user');
  return Redirect::to('/#signin');
}

试试这个,首先创建一个路由

Route::get('auth/logout', ['as' => 'auth.logout', 'uses' => 'Auth'AuthController@getLogout']);

然后添加一个链接,

<a href="{{ route('auth.logout') }}">Logout</a>

或重定向。

public function doLogout(){
    return redirect()->route('auth.logout');
}

您可以查看此文档以了解更多信息http://laravel.com/docs/master/authentication#included-验证