diff options
Diffstat (limited to 'src/HasAuthLogs.php')
-rw-r--r-- | src/HasAuthLogs.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/HasAuthLogs.php b/src/HasAuthLogs.php index 543b580..01aa768 100644 --- a/src/HasAuthLogs.php +++ b/src/HasAuthLogs.php @@ -1,4 +1,4 @@ -<?php +q<?php namespace Lightscale\LaralightAuthLog; @@ -8,9 +8,13 @@ use Lightscale\LaralightAuthLog\Enums\Status; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasOne; use Illuminate\Database\Eloquent\Casts\Attribute; +use Illuminate\Support\Carbon; use DateTimeInterface; +/** + * @property-read ?Carbon $last_login + */ trait HasAuthLogs { @@ -31,10 +35,10 @@ trait HasAuthLogs return $this->successfulAuthLogs()->one(); } - public function lastLogin(): Attribute + protected function lastLogin(): Attribute { return Attribute::get( - fn(): ?DateTimeInterface => $this->successfulAuthLog?->created_at + fn(): ?Carbon => $this->successfulAuthLog?->created_at ); } |