/**
* 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;
}
}