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:
13
13
fail-fast : true
14
14
matrix :
15
15
os : [ubuntu-latest, windows-latest]
16
- php : [8.0, 8. 1]
17
- laravel : [9 .*]
16
+ php : [8.1]
17
+ laravel : [10 .*]
18
18
stability : [prefer-lowest, prefer-stable]
19
19
include :
20
- - laravel : 9 .*
21
- testbench : 7 .0
20
+ - laravel : 10 .*
21
+ testbench : 8 .0
22
22
23
23
name : P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
24
24
Original file line number Diff line number Diff line change 2
2
3
3
All notable changes to ` Laravel Authentication Log ` will be documented in this file.
4
4
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
+
5
11
### 2.0.0 - 2022-02-19
6
12
7
13
### 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
17
17
:---------|:------------------
18
18
8.x | 1.x
19
19
9.x | 2.x
20
+ 10.x | 3.x
21
+
22
+ ## Installation
23
+
24
+ ``` bash
25
+ composer require rappasoft/laravel-authentication-log
26
+ ```
20
27
21
28
## Testing
22
29
Original file line number Diff line number Diff line change 16
16
}
17
17
],
18
18
"require" : {
19
- "php" : " ^8.0 " ,
20
- "illuminate/contracts" : " ^9 .0" ,
19
+ "php" : " ^8.1 " ,
20
+ "illuminate/contracts" : " ^10 .0" ,
21
21
"spatie/laravel-package-tools" : " ^1.4.3"
22
22
},
23
23
"require-dev" : {
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ public function handle($event): void
35
35
]);
36
36
}
37
37
38
- foreach ($ user ->authentications ()->whereLoginSuccessful (true )->get () as $ log ) {
38
+ foreach ($ user ->authentications ()->whereLoginSuccessful (true )->whereNull ( ' logout_at ' )-> get () as $ log ) {
39
39
if ($ log ->id !== $ authenticationLog ->id ) {
40
40
$ log ->update ([
41
41
'cleared_by_user ' => true ,
Original file line number Diff line number Diff line change @@ -25,11 +25,8 @@ class AuthenticationLog extends Model
25
25
'cleared_by_user ' => 'boolean ' ,
26
26
'location ' => 'array ' ,
27
27
'login_successful ' => 'boolean ' ,
28
- ];
29
-
30
- protected $ dates = [
31
- 'login_at ' ,
32
- 'logout_at ' ,
28
+ 'login_at ' => 'datetime ' ,
29
+ 'logout_at ' => 'datetime ' ,
33
30
];
34
31
35
32
public function __construct (array $ attributes = [])
Original file line number Diff line number Diff line change @@ -23,31 +23,31 @@ public function notifyAuthenticationLogVia(): array
23
23
24
24
public function lastLoginAt ()
25
25
{
26
- return optional ( $ this ->authentications ()->first ()) ->login_at ;
26
+ return $ this ->authentications ()->first ()? ->login_at;
27
27
}
28
28
29
29
public function lastSuccessfulLoginAt ()
30
30
{
31
- return optional ( $ this ->authentications ()->whereLoginSuccessful (true )->first ()) ->login_at ;
31
+ return $ this ->authentications ()->whereLoginSuccessful (true )->first ()? ->login_at;
32
32
}
33
33
34
34
public function lastLoginIp ()
35
35
{
36
- return optional ( $ this ->authentications ()->first ()) ->ip_address ;
36
+ return $ this ->authentications ()->first ()? ->ip_address;
37
37
}
38
38
39
39
public function lastSuccessfulLoginIp ()
40
40
{
41
- return optional ( $ this ->authentications ()->whereLoginSuccessful (true )->first ()) ->ip_address ;
41
+ return $ this ->authentications ()->whereLoginSuccessful (true )->first ()? ->ip_address;
42
42
}
43
43
44
44
public function previousLoginAt ()
45
45
{
46
- return optional ( $ this ->authentications ()->skip (1 )->first ()) ->login_at ;
46
+ return $ this ->authentications ()->skip (1 )->first ()? ->login_at;
47
47
}
48
48
49
49
public function previousLoginIp ()
50
50
{
51
- return optional ( $ this ->authentications ()->skip (1 )->first ()) ->ip_address ;
51
+ return $ this ->authentications ()->skip (1 )->first ()? ->ip_address;
52
52
}
53
53
}
You can’t perform that action at this time.
0 commit comments