Skip to content

Commit 480fe88

Browse files
committed
Refactor recordActiveDate() to avoid updating the 'updated_at' column
1 parent d632fa1 commit 480fe88

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/Authentication/Authenticators/AccessTokens.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,6 @@ public function recordActiveDate(): void
237237

238238
$this->user->last_active = Time::now();
239239

240-
$this->provider->save($this->user);
240+
$this->provider->updateActiveDate($this->user);
241241
}
242242
}

src/Authentication/Authenticators/Session.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ public function recordActiveDate(): void
830830

831831
$this->user->last_active = Time::now();
832832

833-
$this->provider->save($this->user);
833+
$this->provider->updateActiveDate($this->user);
834834
}
835835

836836
/**

src/Models/UserModel.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,4 +320,14 @@ protected function saveEmailIdentity(array $data): array
320320

321321
return $data;
322322
}
323+
324+
/**
325+
* Updates the user's last active date.
326+
*/
327+
public function updateActiveDate(User $user): void
328+
{
329+
$this->builder->set('last_active', $user->last_active)
330+
->where('id', $user->id)
331+
->update();
332+
}
323333
}

0 commit comments

Comments
 (0)