Support the ongoing development of Laravel.io →
Authentication Security Session
Last updated 1 year ago.
0

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 1 year ago.
0

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 1 year ago.
0

Do a before filter on every page.

App::before(function($request)
{
    // Check if user is logged in
    // If true store user id
    // else don't
});
Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

joy014 joy014 Joined 12 Apr 2014

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.

© 2024 Laravel.io - All rights reserved.