-
app/Listeners/UpdateLoginData.php
Open in GitHubuse Illuminate\Auth\Events\Login; class UpdateLoginData { public function handle(Login $event) { $user = $event->user; $user->total_logins += 1; $user->save(); } }
-
app/Providers/EventServiceProvider.php
Open in GitHubuse App\Listeners\UpdateLoginData; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; class EventServiceProvider extends ServiceProvider { protected $listen = [ \Illuminate\Auth\Events\Login::class => [ UpdateLoginData::class ] ]; }