Reputation: 173
Hi I tried to implement logging out. I also added remember_token in users table. It gets updated when I log in but I am not able to log out with the following function. Is there more I need to add to log out?
public function doLogout(){
Auth::logout();
Session::forget('user');
return Redirect::to('/#signin');
}
Upvotes: 2
Views: 192
Reputation: 281
Try this instead, first create a route
Route::get('auth/logout', ['as' => 'auth.logout', 'uses' => 'Auth\AuthController@getLogout']);
then add a link,
<a href="{{ route('auth.logout') }}">Logout</a>
or redirect.
public function doLogout(){
return redirect()->route('auth.logout');
}
you can check this documentation for more informations http://laravel.com/docs/master/authentication#included-authenticating
Upvotes: 1