本文整理匯總了PHP中app\Auth::findByAppAndTelegramUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP Auth::findByAppAndTelegramUser方法的具體用法?PHP Auth::findByAppAndTelegramUser怎麽用?PHP Auth::findByAppAndTelegramUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Auth
的用法示例。
在下文中一共展示了Auth::findByAppAndTelegramUser方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: commandReply
private function commandReply($message)
{
$telegramId = $message['from']['id'];
$tg = TelegramUser::findByTelegramId($telegramId);
$params = array('chat_id' => $telegramId);
if ($tg->status == 'revoke_access') {
$clientId = preg_replace('/[^0-9,.]/', '', $message['text']);
try {
$app = App::findByClientId($clientId);
$auth = Auth::findByAppAndTelegramUser($app, $tg);
$auth->active = false;
$auth->save();
$text = 'Access to this app has been revoked.';
$tg->status = 'access_revoked';
$params['reply_markup'] = json_encode(['hide_keyboard' => true]);
} catch (ModelNotFoundException $e) {
$text = 'Unknown app. Please choose an app from the given list:';
}
} else {
$text = 'Unknown command.';
$tg->status = 'unknown_command';
$params['reply_markup'] = json_encode(['hide_keyboard' => true]);
}
$params['text'] = $text;
$this->send($params);
$tg->save();
}