notification

This commit is contained in:
2025-01-27 20:03:58 +03:00
parent 4692c70378
commit 6534b3155d
19 changed files with 670 additions and 38 deletions

View File

@ -0,0 +1,30 @@
<?php
namespace kernel\app_modules\tgbot\controllers;
use JetBrains\PhpStorm\NoReturn;
use kernel\app_modules\tgbot\models\TgbotNotification;
use kernel\RestController;
class TgbotNotificationRestController extends RestController
{
public function __construct()
{
$this->model = new TgbotNotification();
}
#[NoReturn] public function actionGetToSend(): void
{
$notification = TgbotNotification::where("status", TgbotNotification::TO_SEND_STATUS)->first();
if ($notification){
$notification->status = TgbotNotification::SENT_STATUS;
$notification->save();
$this->renderApi($notification->toArray());
}
$this->renderApi([]);
}
}