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