Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

DiogoGomes's avatar

Database Session Sets user_id to null...

Hi all,

I'm using database session driver, to register all users online. The problem is that I also want to register the last_activity of all users. But the database Session Sets user_id to null when user logs out, so I can't retrieve the users last_activity.

I'm not sure what is the best way to tackle this. Do I have to make a custom session driver? or is there a simpler approach?

Thanks

0 likes
1 reply
SaeedPrez's avatar

Do you want to show how many have users have been online last X minutes? If so, cache might be a better option.

Please or to participate in this conversation.