Does a given token exist in the database?

@param  text  $token
@return bool
965703
public function isTokenValid($token) {
        $record = List_Unsubscribe_Token::where('token', $token)->first();

        if (!$record) {
            return false;
        }
        return true;
    }
631479
public function validateToken($token)
    {
        if (isset($_SESSION[$this->session_name])) {
            if ($_SESSION[$this->session_name] === $token) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
1141939
public static function isAccessTokenValid($token)
    {
        if (empty($token)) {
            return false;
        }
        $data = Yii::$app->jwt->getValidationData(); // It will use the current time to validate (iat, nbf and exp)
        $data->setIssuer(Yii::getAlias("@restIssuer"));
        $data->setAudience(Yii::getAlias("@restAudience"));
        $data->setId(Yii::getAlias("@restId")+strtotime(date('Y-m-d',time())), true);
        if (is_string($token))
            $token = Yii::$app->jwt->getParser()->parse($token);

        return $token->validate($data);
    }
642757
public function validateForgotPasswordToken($username, $token)
    {
        $this->username = $username;

        if ($this->getMeta()->forgotPasswordToken == $token) {
            $this->getMeta()->forgotPasswordToken = '';
            $this->getMeta()->save();

            return true;
        }

        return false;
    }
99476
public function hasToken($tokenCheck, $forceExpire = true)
	{
		$stored = $this->get('session.token');

		if ($stored !== $tokenCheck) {

			if ($forceExpire) {
				$this->_state = self::STATE_EXPIRED;
			}

			return false;
		}

		return true;
	}
154675
public static function hasToken(array $coll, $token)
    {
        if (!\is_array($token)) {
            return false;
        }

        return \in_array(\token_name($token[0]), $coll);
    }
10365
private function isOpenTag($token): bool
    {
        if (!is_array($token)) {
            return false;
        }

        if ($token[0] == T_ECHO && $token[1] == '<?=') {
            return true;
        }

        return $token[0] == T_OPEN_TAG || $token[0] == T_OPEN_TAG_WITH_ECHO;
    }
1308612
protected function validatePasswordResetToken($token)
    {
        if (!is_string($this->passwordResetTokenAttribute) || empty($this->passwordResetTokenAttribute)) {
            return true;
        }
        return $this->getPasswordResetToken() === $token;
    }
982558
protected function _verify($token)
    {
        if (empty($token)) {
            $this->_tokenError();
        }

        $subject = $this->_subject();
        $subject->set([
            'token' => $token,
            'repository' => $this->_table(),
            'query' => $this->_table()->find(
                $this->findMethod(),
                [
                    'token' => $token,
                    'conditions' => [$this->_table()->aliasField($this->config('tokenField')) => $token]
                ]
            ),
        ]);

        $this->_trigger('beforeFind', $subject);
        $entity = $subject->query->first();

        if (empty($token)) {
            $this->_tokenError();
        }

        $subject->set(['entity' => $entity]);
        $this->_trigger('afterFind', $subject);

        if (!isset($subject->verified)) {
            $subject->set(['verified' => false]);
        }
        $this->_trigger('verifyToken', $subject);

        if ($subject->verified) {
            return $subject->entity;
        }

        $this->_tokenError('tokenExpired');
    }
482266
protected function isTokenExpired($token)
    {
        return !$token ||
            (
                $token->getCreationTtl() > 0 &&
                time() > $token->getCreationTime() + $token->getCreationTtl()
            );
    }
1288047
public function isValid(Token $token = null)
    {
        return !is_null($token) && $token->getType() == $this->config['type'] && $this->checkObfuscatePart($token);
    }
1193157
private function isConstantToken($token)
    {
        return $token == T_CONSTANT_ENCAPSED_STRING || $token == T_STRING || $token == T_LNUMBER || $token == T_DNUMBER;
    }
798550
public function userByResetPasswordToken($token)
    {
        if($email = app('account.password')->getEmailByToken($token)){

            return $this->findByEmail($email);
        }

        return false;
    }
263753
private function verifyPersistToken($username, $token)
	{
		$this->debug->groupCollapsed(__METHOD__);
		$return = false;
		$vals = array(
			'username'		=> $this->db->quoteValue($username),
			'token_hash'	=> $this->db->quoteValue(sha1($token)),
		);
		$query = Str::quickTemp('SELECT * FROM `persist_tokens`
			LEFT JOIN `user_auth`
				ON `user_auth`.`username` = [::username::]
				AND `user_auth`.`userid` = `persist_tokens`.`userid`
			WHERE `token_hash` = [::token_hash::]
			ORDER BY `datetime` DESC', $vals);
		$rows = $this->db->query($query)[0];
		$this->debug->table($rows, 'rows');
		if ($rows) {
			// found token in table
			$return = $rows[0]['userid'];
			// remove the token
			$where = array();
			foreach (array('userid','datetime','token_hash') as $k) {
				$where[$k] = $rows[0][$k];
			}
			$this->db->rowMan('persist_tokens', null, $where);
			$this->log('persistTokenSuccess', $rows[0]['userid']);
		} else {
			$this->log('persistTokenFail');
		}
		$this->debug->groupEnd();
		return $return;
	}
1189537
protected function checkToken($token)
    {
        if (!array_key_exists($token, $this->tokens)) {
            throw new TokenNotFoundException($token, get_called_class());
        }

        return $this->tokens[$token];
    }
906483
protected function checkToken($token)
    {
        if (!$token) {
            return false;
        }

        $file = $this->pathForToken($token);
        $content = null;

        if (file_exists($file)) {
            $content = file_get_contents($file);
            unlink($file);
        }

        return $content === $token;
    }
262800
public function check(string $scenario, string $token): bool
    {
        $t    = microtime(true);
        $data = Params::get($this->id, $scenario);
        $this->handle($token, $data);
        if ($this->Debug) {
            $this->Debug->check($this->id, $scenario, $this->code, microtime(true) - $t);
        }
        return $this->code === self::VALID;
    }