Hey All,
I'm currently building a project with Laravel 5.1, and there exists a page where users can see which other users are currently online, provided they have been active for the last 10 minutes; so far, this works well. This was achieved by writing user sessions to the database, through which I've also created an additional 'user_id' field in the sessions table that associates each session with the user's corresponding id.
However, if a user signs in from more than one location within that 10 minute period of being active, the user will appear in the table of online users multiple times, which is equal to the amount of sessions that currently exist in the 'sessions' table for that user.
That being said, is there any way in Laravel through which I can either merge (or refer back to) an existing session if the user signs in through another browser, or equally, delete the existing session on log in (I believe this may be more difficult to implement).
Moreover, are there any guidelines or best practices on handling what I'd like to achieve above? I would like to move forward with the cleanest solution possible :)
Thank you!