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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners