Tuesday, February 28, 2017

How to store into database on page Refresh with Laravel?

I want to check if users are using the system.

I know have a last_login, with the standard laravel class UpdateLastLoggedInAt.

public function handle(Login $event)
{
    $event->user->last_login = Carbon::now();
    $event->user->save();
}

This doesn't work if users let their browser window stay open.

Is there a way to have it so that on every page refresh or route change (users navigates through the website), change the last_login to that time?

Thanks in advance.




via Jordy Groote

Advertisement