Source: medium.com

Laravel Force User Logout

Category: Laravel

Many times we store data in user session. Now what if that session data is updated and we want to show updated data to user ? Because user is already logged in, new data won’t be visible for user.

This code will check if current user has “should_re_login” == 1, then it will make it 0, break the session and redirect user to login page.

In above process, Step 2 will be used if user is already logged in and we want to break the session.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners