Source: paulund.co.uk

Laravel User Last Logged In
In this tutorial we're going to create a new Laravel listener that will listen to the user logged in event and then update the user record with the time they logged in. This is a handy feature to check how often your users are logging in and which ones are most active in your application.

The event we're going to listen for is Illuminate\Auth\Events\Login which will run when the user logs into your application.

https://paulund.co.uk/laravel-user-last-logged-in#logged-in-listenerWith the new column created we can listen for the logged in event and save the current date time to the user column.

Now whenever a user logs into your application we'll store the last time that user was able to login.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners