本文整理汇总了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();
}