public function UserStorage::updateLastAccessTimestamp in Drupal 9
Same name and namespace in other branches
- 8 core/modules/user/src/UserStorage.php \Drupal\user\UserStorage::updateLastAccessTimestamp()
Update the last access timestamp of the user.
Parameters
\Drupal\Core\Session\AccountInterface $account: The user object.
int $timestamp: The last access timestamp.
Overrides UserStorageInterface::updateLastAccessTimestamp
File
- core/
modules/ user/ src/ UserStorage.php, line 56
Class
- UserStorage
- Controller class for users.
Namespace
Drupal\userCode
public function updateLastAccessTimestamp(AccountInterface $account, $timestamp) {
$this->database
->update($this
->getDataTable())
->fields([
'access' => $timestamp,
])
->condition('uid', $account
->id())
->execute();
// Ensure that the entity cache is cleared.
$this
->resetCache([
$account
->id(),
]);
}