Support the ongoing development of Laravel.io →
Laravel Session Sanctum

Is there a way to retrieve all user sessions and sessions for the current login user from the session table in laravel?

I have database table for session and populates when users login.

The laravel documentation on https://laravel.com/docs/8.x/session shows how to store and retrieve data from the session but it does not show how to manage sessions.

Last updated 3 years ago.
0
moderator Solution

If you use the database driver you could create a model for the sessions table (important note, it doesn't have the default timestamps) With that you could load it like any other data and list or delete it.

Small warning: if you want to change the payload (the data stored in the session) you need to be careful because you can damage that session and create strange situations. But showing the sessions with data like ip and user_agent and deleting other sessions should be possible.

0

Sign in to participate in this thread!

PHPverse

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.