diff --git a/CHANGELOG.md b/CHANGELOG.md index fde0cb6..5f66af6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to `Laravel Authentication Log` will be documented in this file. +### 1.1.1 - 2021-10-20 + +### Changed + +- Logout listener bug fix - https://github.com/rappasoft/laravel-authentication-log/pull/10 + ### 1.1.0 - 2021-10-11 ### Added diff --git a/src/Listeners/LogoutListener.php b/src/Listeners/LogoutListener.php index 30a9f00..182b354 100644 --- a/src/Listeners/LogoutListener.php +++ b/src/Listeners/LogoutListener.php @@ -21,7 +21,7 @@ public function handle(Logout $event): void $user = $event->user; $ip = $this->request->ip(); $userAgent = $this->request->userAgent(); - $log = $user->authentications()->whereIpAddress($ip)->whereUserAgent($userAgent)->first(); + $log = $user->authentications()->whereIpAddress($ip)->whereUserAgent($userAgent)->orderByDesc('login_at')->first(); if (! $log) { $log = new AuthenticationLog([