Level 11
You should probably not allow for storing multiple session ids per user in the DB. Maybe you should have a one to one relationship between user and session tables.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am storing sessions in the db. How can I get the current logged in user's session id. Some will say that you can do something like this: Session::where('user_id',Auth::user()->id)->get();
But if the user is also logged in from somewhere else then I will have 2 session id's how can I determine which one is the current user executing the code right now.
Please or to participate in this conversation.