/** * Get a user by login token. * * @param string $token * @return \stdclass | bool */ public function getByToken($token) { $TWO_WEEKS = 14; $limit = Carbon::now()->subDays($TWO_WEEKS); $tokenResult = $this->loginTokenRepo->getValidLoginToken($token, $limit); if (isset($tokenResult)) { $user = $this->getById($tokenResult->user_id); return $user; } else { return false; } }
public function deleteOldRememberToken($token) { $this->loginTokenRepo->deleteLoginTokenByToken($token); }
/** * Update the "remember me" token by user ID. * * @param int $userId * @param string $token * * @return bool */ public function updateToken($userId, $token) { $params = compact('token'); $wkey = ['user_id' => $userId]; return (bool) $this->loginTokenRepo->update($params, $wkey); }