I am having issues logging out of a laravel 5.1 app - I believe the issue is that the session is not destroyed.
My question is nearly identical to:
Laravel 5 Auth Logout not destroying session
with the caveat that my solution is to use
session_unset();
rather than
Session::flush();
so my working solution to logging out of a laravel 5.1 app is:
public function getLogout()
{
\Auth::logout();
session_unset();
return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/');
//these attempts will not remove values from the session.....
//session()->forget('db');
//\Session::flush();
}
any ideas why \Session::flush();
and session()->forget('db');
are not working?
Could you try this:
Auth::logout();
Session::flush();
If It's not working, check "'driver' => 'file'"
or "'domain' => null"
sections in Config->Session.php.
Try This Code
Auth::logout();
or
session_unset();
or
Session::flush();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With