Skip to content

Commit

Permalink
Merge pull request #92 from tungtm-unica/main
Browse files Browse the repository at this point in the history
add config listeners
  • Loading branch information
rappasoft authored Mar 29, 2024
2 parents 1621f54 + be5ddd8 commit 0a40a17
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions config/authentication-log.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
'logout-other-devices' => \Illuminate\Auth\Events\OtherDeviceLogout::class,
],

'listeners' => [
'login' => \Rappasoft\LaravelAuthenticationLog\Listeners\LoginListener::class,
'failed' => \Rappasoft\LaravelAuthenticationLog\Listeners\FailedLoginListener::class,
'logout' => \Rappasoft\LaravelAuthenticationLog\Listeners\LogoutListener::class,
'logout-other-devices' => \Rappasoft\LaravelAuthenticationLog\Listeners\OtherDeviceLogoutListener::class,
],

'notifications' => [
'new-device' => [
// Send the NewDevice notification
Expand Down
8 changes: 4 additions & 4 deletions src/LaravelAuthenticationLogServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public function configurePackage(Package $package): void
->hasCommand(PurgeAuthenticationLogCommand::class);

$events = $this->app->make(Dispatcher::class);
$events->listen(config('authentication-log.events.login', Login::class), LoginListener::class);
$events->listen(config('authentication-log.events.failed', Failed::class), FailedLoginListener::class);
$events->listen(config('authentication-log.events.logout', Logout::class), LogoutListener::class);
$events->listen(config('authentication-log.events.other-device-logout', OtherDeviceLogout::class), OtherDeviceLogoutListener::class);
$events->listen(config('authentication-log.events.login', Login::class), config('authentication-log.listeners.login', LoginListener::class));
$events->listen(config('authentication-log.events.failed', Failed::class), config('authentication-log.listeners.failed', FailedLoginListener::class));
$events->listen(config('authentication-log.events.logout', Logout::class), config('authentication-log.listeners.logout', LogoutListener::class));
$events->listen(config('authentication-log.events.other-device-logout', OtherDeviceLogout::class), config('authentication-log.listeners.other-device-logout', OtherDeviceLogoutListener::class));
}
}

0 comments on commit 0a40a17

Please sign in to comment.