Skip to content

Commit 33f601d

Browse files
committed
feat: upgrade authentication log
Major update from 5 to 6.
1 parent 1872220 commit 33f601d

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

app/Models/User.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
* @property-read \Illuminate\Database\Eloquent\Collection<int, \Rappasoft\LaravelAuthenticationLog\Models\AuthenticationLog> $authentications
4242
* @property-read int|null $authentications_count
4343
* @property-read \App\Models\Author|null $author
44+
*
45+
* @method \Illuminate\Database\Eloquent\Relations\MorphMany<\Rappasoft\LaravelAuthenticationLog\Models\AuthenticationLog, $this> authentications()
46+
*
4447
* @property-read string $full_name
4548
* @property-read \App\Models\Invitation|null $invitation
4649
* @property-read \Rappasoft\LaravelAuthenticationLog\Models\AuthenticationLog|null $latestAuthentication
@@ -304,7 +307,7 @@ public function sendPasswordResetNotification($token): void
304307

305308
public function previousSuccessfulLoginAt()
306309
{
307-
return $this->authentications()->whereLoginSuccessful(true)->skip(1)->first()?->login_at;
310+
return $this->authentications()->successful()->skip(1)->first()?->login_at;
308311
}
309312

310313
/** Is this a Regional Editor */

database/migrations/2025_12_30_182100_add_new_features_to_authentication_log_table.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
public function up(): void
1010
{
1111
$tableName = config('authentication-log.table_name', 'authentication_log');
12-
12+
1313
if (! Schema::hasTable($tableName)) {
1414
return;
1515
}
@@ -61,7 +61,7 @@ public function up(): void
6161
public function down(): void
6262
{
6363
$tableName = config('authentication-log.table_name', 'authentication_log');
64-
64+
6565
if (! Schema::hasTable($tableName)) {
6666
return;
6767
}
@@ -84,4 +84,3 @@ public function down(): void
8484
});
8585
}
8686
};
87-

0 commit comments

Comments
 (0)