File tree Expand file tree Collapse file tree 7 files changed +28
-18
lines changed Expand file tree Collapse file tree 7 files changed +28
-18
lines changed Original file line number Diff line number Diff line change @@ -13,12 +13,12 @@ jobs:
1313 fail-fast : true
1414 matrix :
1515 os : [ubuntu-latest, windows-latest]
16- php : [8.0, 8. 1]
17- laravel : [9 .*]
16+ php : [8.1]
17+ laravel : [10 .*]
1818 stability : [prefer-lowest, prefer-stable]
1919 include :
20- - laravel : 9 .*
21- testbench : 7 .0
20+ - laravel : 10 .*
21+ testbench : 8 .0
2222
2323 name : P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2424
Original file line number Diff line number Diff line change 22
33All notable changes to ` Laravel Authentication Log ` will be documented in this file.
44
5+ ### 3.0.0 - 2023-02-23
6+
7+ - Laravel 10 Support - https://github.com/rappasoft/laravel-authentication-log/pull/70
8+ - Use null safe/chaining operator - https://github.com/rappasoft/laravel-authentication-log/pull/57
9+ - Optimize Other Devices Logout Listener - https://github.com/rappasoft/laravel-authentication-log/pull/52
10+
511### 2.0.0 - 2022-02-19
612
713### Added
Original file line number Diff line number Diff line change @@ -17,6 +17,13 @@ See the [documentation](https://rappasoft.com/docs/laravel-authentication-log) f
1717:---------|:------------------
1818 8.x | 1.x
1919 9.x | 2.x
20+ 10.x | 3.x
21+
22+ ## Installation
23+
24+ ``` bash
25+ composer require rappasoft/laravel-authentication-log
26+ ```
2027
2128## Testing
2229
Original file line number Diff line number Diff line change 1616 }
1717 ],
1818 "require" : {
19- "php" : " ^8.0 " ,
20- "illuminate/contracts" : " ^9 .0" ,
19+ "php" : " ^8.1 " ,
20+ "illuminate/contracts" : " ^10 .0" ,
2121 "spatie/laravel-package-tools" : " ^1.4.3"
2222 },
2323 "require-dev" : {
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ public function handle($event): void
3535 ]);
3636 }
3737
38- foreach ($ user ->authentications ()->whereLoginSuccessful (true )->get () as $ log ) {
38+ foreach ($ user ->authentications ()->whereLoginSuccessful (true )->whereNull ( ' logout_at ' )-> get () as $ log ) {
3939 if ($ log ->id !== $ authenticationLog ->id ) {
4040 $ log ->update ([
4141 'cleared_by_user ' => true ,
Original file line number Diff line number Diff line change @@ -25,11 +25,8 @@ class AuthenticationLog extends Model
2525 'cleared_by_user ' => 'boolean ' ,
2626 'location ' => 'array ' ,
2727 'login_successful ' => 'boolean ' ,
28- ];
29-
30- protected $ dates = [
31- 'login_at ' ,
32- 'logout_at ' ,
28+ 'login_at ' => 'datetime ' ,
29+ 'logout_at ' => 'datetime ' ,
3330 ];
3431
3532 public function __construct (array $ attributes = [])
Original file line number Diff line number Diff line change @@ -23,31 +23,31 @@ public function notifyAuthenticationLogVia(): array
2323
2424 public function lastLoginAt ()
2525 {
26- return optional ( $ this ->authentications ()->first ()) ->login_at ;
26+ return $ this ->authentications ()->first ()? ->login_at;
2727 }
2828
2929 public function lastSuccessfulLoginAt ()
3030 {
31- return optional ( $ this ->authentications ()->whereLoginSuccessful (true )->first ()) ->login_at ;
31+ return $ this ->authentications ()->whereLoginSuccessful (true )->first ()? ->login_at;
3232 }
3333
3434 public function lastLoginIp ()
3535 {
36- return optional ( $ this ->authentications ()->first ()) ->ip_address ;
36+ return $ this ->authentications ()->first ()? ->ip_address;
3737 }
3838
3939 public function lastSuccessfulLoginIp ()
4040 {
41- return optional ( $ this ->authentications ()->whereLoginSuccessful (true )->first ()) ->ip_address ;
41+ return $ this ->authentications ()->whereLoginSuccessful (true )->first ()? ->ip_address;
4242 }
4343
4444 public function previousLoginAt ()
4545 {
46- return optional ( $ this ->authentications ()->skip (1 )->first ()) ->login_at ;
46+ return $ this ->authentications ()->skip (1 )->first ()? ->login_at;
4747 }
4848
4949 public function previousLoginIp ()
5050 {
51- return optional ( $ this ->authentications ()->skip (1 )->first ()) ->ip_address ;
51+ return $ this ->authentications ()->skip (1 )->first ()? ->ip_address;
5252 }
5353}
You can’t perform that action at this time.
0 commit comments