My app allows users to log in and manage their data. But if a user is logged in and an admin removes that user, that user is still logged in in the application. I looked into the Auth::logout method, but this is only available for the authenticated user. Does anyone have a good solution for this/
You could do this by storing a user_id in the session. And checking if the user still exist every request someone makes.
create a filter that checks if the user is still in the database and log him/her out if not
Auth::user(); // queries the database
You could save in the Users table a field that manage the remove action of the admin (example removed field as bool type) you could use Ajax with a timeout method in the layout.main.php view to observe all request of the User, and if the user removed has the field with a true value, you could send an event to the Application to force logout.
Hope it helps you.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community