function UserStorage::updateLastAccessTimestamp

Same name and namespace in other branches
  1. 11.x core/modules/user/src/UserStorage.php \Drupal\user\UserStorage::updateLastAccessTimestamp()
  2. 10 core/modules/user/src/UserStorage.php \Drupal\user\UserStorage::updateLastAccessTimestamp()
  3. 8.9.x core/modules/user/src/UserStorage.php \Drupal\user\UserStorage::updateLastAccessTimestamp()

File

core/modules/user/src/UserStorage.php, line 56

Class

UserStorage
Controller class for users.

Namespace

Drupal\user

Code

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(),
  ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.