Reputation: 289
As we all know, we can use the function session_destory() to delete the session file in PHP.But I do not know how to delete session file in Laravel due to the reason that the author rewrites the session module. Expecting your answers.
Upvotes: 0
Views: 7654
Reputation: 1504
If you have set the session storage option in files and if you finding difficulties flushing sessions from coding , It happens sometime . Then you ultimate solution go directly to the files where it is being stored and delete the file and you see your all session will be gone for good.
session files are stored in following path with random chars.
yourfoldername/storage/framework/sessions/
Upvotes: 0
Reputation: 289
I find the answer by reading the original code in laravel framwork!
session()->getHandler()->destroy();
I hope it will help others.
Upvotes: 0
Reputation: 628
You have to use Session flush as shown below:
Session::flush(); // destroy all the session.
Upvotes: 1
Reputation: 4040
Just use this
Session::flush();
in Laravel to destroy all the session.
Upvotes: 1
Reputation: 11636
A handy route I use while in development only:
Route::get('/flush', function () {
Session::flush();
return redirect('/login');
})->name('flush');
Upvotes: 2