fix
This commit is contained in:
26
app/modules/tgbot/middlewares/TgBotAuthMiddleware.php
Normal file
26
app/modules/tgbot/middlewares/TgBotAuthMiddleware.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace app\modules\tgbot\middlewares;
|
||||
|
||||
use app\modules\tgbot\models\Tgbot;
|
||||
use app\modules\tgbot\services\TgBotService;
|
||||
use kernel\Middleware;
|
||||
|
||||
class TgBotAuthMiddleware extends Middleware
|
||||
{
|
||||
|
||||
function handler(): void
|
||||
{
|
||||
if(isset($_COOKIE['dialog_id']))
|
||||
{
|
||||
$model = Tgbot::where("dialog_id", $_COOKIE['dialog_id'])->first();
|
||||
if ($model){
|
||||
TgBotService::$currentDialog = $model;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
exit();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user