You are here

public function MongodbUserStorage::updateLastAccessTimestamp in MongoDB 8

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

mongodb_user/src/MongodbUserStorage.php, line 30
Definition of Drupal\mongodb_user\MongodbUserStorage.

Class

MongodbUserStorage

Namespace

Drupal\mongodb_user

Code

public function updateLastAccessTimestamp(AccountInterface $account, $timestamp) {
  $this->mongo
    ->get('entity.user')
    ->update([
    '_id' => $account
      ->id(),
  ], [
    '$set' => [
      'access' => $timestamp,
    ],
  ]);
}