File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,11 @@ Get the user's last login information:
109109``` php
110110User::find(1)->lastLoginAt();
111111
112+ User::find(1)->lastSuccessfulLoginAt();
113+
112114User::find(1)->lastLoginIp();
115+
116+ User::find(1)->lastSuccessfulLoginIp();
113117```
114118
115119Get the user's previous login time & IP address (ignoring the current login):
Original file line number Diff line number Diff line change @@ -21,11 +21,21 @@ public function lastLoginAt()
2121 return optional ($ this ->authentications ()->first ())->login_at ;
2222 }
2323
24+ public function lastSuccessfulLoginAt ()
25+ {
26+ return optional ($ this ->authentications ()->whereLoginSuccessful (true )->first ())->login_at ;
27+ }
28+
2429 public function lastLoginIp ()
2530 {
2631 return optional ($ this ->authentications ()->first ())->ip_address ;
2732 }
2833
34+ public function lastSuccessfulLoginIp ()
35+ {
36+ return optional ($ this ->authentications ()->whereLoginSuccessful (true )->first ())->ip_address ;
37+ }
38+
2939 public function previousLoginAt ()
3040 {
3141 return optional ($ this ->authentications ()->skip (1 )->first ())->login_at ;
You can’t perform that action at this time.
0 commit comments