0

I am using laravel 5.2 auth system to manage users but i have to delete a specific session variable after user logged out from the site. but i dont know where to place the session destroy function to achieve this.

2 Answers 2

1

Use Session::flush(); to delete all variable

And Session::forget('key'); for particular key.

Use any of these after Logout and before you redirect to some page which could look like as below

public function getLogout() {
    auth()->logout();

    return redirect()->route('index');
}
Sign up to request clarification or add additional context in comments.

Comments

0

i faced same issue and solved by using Session::forget('password_hash')

public function doLogout() {
 
 Session::forget('password_hash');
 Auth::logout();
 return Redirect::to(route( 'home').'/');

}

Find session values by dd(Session::all());

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.