Level 56
You can add a listener on your EventsServiceProvider that listens to this event: Illuminate\Auth\Events\Login
A listener to the exact same event to save the last login timestamp in one of my projects:
<?php
namespace App\Providers;
use App\Auth\Listeners\UpdateLoginInfoListener;
use Illuminate\Auth\Events\Login;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array<class-string, array<int, class-string>>
*/
protected $listen = [
Login::class => [UpdateLoginInfoListener::class],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
}
}
If you are not familiar with event listener, please look the docs about it: