1

I am trying to get online users count in Laravel 4. I am using Sentry 2 with Laravel. There are 2 columns in users table which are last_login and updated_at. I am confused at this point, because everytime last_login and updated_at columns have same value. How do i set new update value in which user operation, even page reload? If it so i can calculate the time between last_login and updated_at, so i can see online users easly.

Or is there an easy way to find online users in Laravel?

Thanks for helping.

yigitozmen
  • 947
  • 4
  • 23
  • 42

1 Answers1

1

Personally I would go with the suggestion from this link:

https://stackoverflow.com/a/4073355/3353724

In laravel, I would do this:

  1. Add 'last_seen' column in users table
  2. In App::before filter, add a logic to update the 'last_seen' column if user is logged in.
  3. To check for online user, check if current time minus "last seen"-time is greater than some threshold you like.
Community
  • 1
  • 1