New login/logout events in 5.2
Closed this issue · 0 comments
jszobody commented
Laravel 5.2 changes a bunch of events including auth.login
and auth.logout
to event objects.
- auth.login -> Illuminate\Auth\Events\Login
- auth.logout -> Illuminate\Auth\Events\Logout
For now I've just dropped this into my own AppServiceProvider so I can keep moving forward with my 5.2 upgrade:
$app['events']->listen(\Illuminate\Auth\Events\Login::class, function($event) use($app){
$app['security.token_storage']->setToken(new LaravelToken($event->user));
});
$app['events']->listen(\Illuminate\Auth\Events\Logout::class, function() use($app){
$app['security.token_storage']->setToken(new LaravelToken(null));
});