I\'m building a very simple app in Laravel 5.2, but when using AuthController
\'s action to log out, it just simply doesn\'t work. I have a nav bar which checks
/**
* Log the user out of the application.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function logout(Request $request)
{
$this->guard()->logout();
$request->session()->flush();
$request->session()->regenerate();
return redirect('/');
}
/**
* Get the guard to be used during authentication.
*
* @return \Illuminate\Contracts\Auth\StatefulGuard
*/
protected function guard()
{
return Auth::guard();
}
use below code
Auth::logout();
or
auth()->logout();