Reputation: 367
Is there a way to destroy all sessions? I need to logout all users and wondering if this is possible with astrisan?
Thank you!
Upvotes: 5
Views: 7361
Reputation: 370
I know that I come little too late to the party but the easiest method to destroy all existing sessions is to change session cookie name. That way all sessions will be lost for existing users no matter what session storage you use and it won't affect anything else except your sessions.
In your .env file change or add this line:
SESSION_COOKIE="your_new_session_cookie_name"
Instead of "your_new_session_cookie" you can put anything you want as long it is different from the previous value. By default if this variable is not set laravel will use slugified version of "{APP_NAME}"_session" for session cookie name or "laravel_session" if APP_NAME variable is not defined.
Upvotes: 2
Reputation: 2352
it's really depend on with session drive you picked.
storage/framework/sessions
pathphp artisan cache:clear
for any other driver you can do that like others.
Upvotes: 11
Reputation: 1589
You can do that by deleting all files under this path
storage/framework/sessions
Upvotes: 2