I'm using Laravel 3
. How do I have a notice that can tell me how many users are currently logged in.
I wish I could explain this better but I am new to Laravel and I should upgrade to 5.1 but that is not a option at the moment.
Any help is appreciated.
Step 1: upgrade to Laravel 5.x
Step 2: add a migration to add the column active_at
as a date to the users
table
Step 3: add a new HTTP middleware called ActiveUser
Step 4: in the middleware handle method:
if ($user = $request->user()) {
$user->active_at = new \DateTime();
$user->save();
}
Step 5: feed your baby dragon
Step 6: you can now get users by activity using the active_at
column