Total Complexity | 6 |
Total Lines | 49 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | trait AuthenticationLogable |
||
9 | { |
||
10 | /** |
||
11 | * Get the entity's authentications. |
||
12 | */ |
||
13 | public function authentications(): MorphMany |
||
14 | { |
||
15 | /** @var HasRelationships $this */ |
||
16 | return $this->morphMany(AuthenticationLog::class, 'authenticatable')->latest('login_at'); |
||
17 | } |
||
18 | |||
19 | /** |
||
20 | * The Authentication Log notifications delivery channels. |
||
21 | */ |
||
22 | public function notifyAuthenticationLogVia(): array |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * Get the entity's last login at. |
||
29 | */ |
||
30 | public function lastLoginAt() |
||
31 | { |
||
32 | return optional($this->authentications()->first())->login_at; |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Get the entity's last login ip address. |
||
37 | */ |
||
38 | public function lastLoginIp() |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * Get the entity's previous login at. |
||
45 | */ |
||
46 | public function previousLoginAt() |
||
47 | { |
||
48 | return optional($this->authentications()->skip(1)->first())->login_at; |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * Get the entity's previous login ip. |
||
53 | */ |
||
54 | public function previousLoginIp() |
||
57 | } |
||
58 | } |
||
59 |