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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners