Support the ongoing development of →
Authentication Security Session
Last updated 2 years ago.

Maybe you can achieve this by storing a user_id in the session. When a user logs in check if a user_id is in a session already. And so on.

Last updated 2 years ago.

I am half way there with eriktisme's idea

I changed the Session.php from 'driver'=>'file' to 'driver'=>'database'

Now each active session is being saved in the Database table "Sessions"

But the problem is its saving only id, payload, last_activity and even for the same userIDs the id is different.

If i could somehow store an extra field say "user_id" i can then achieve what i asked above using database observers.

But how do i store "user_id" and instruct laravel to save it everytime a session starts?

Last updated 2 years ago.

Do a before filter on every page.

    // Check if user is logged in
    // If true store user id
    // else don't
Last updated 2 years ago.

Sign in to participate in this thread!


Your banner here too?

joy014 joy014 Joined 12 Apr 2014


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

Your logo here?

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

© 2024 - All rights reserved.