notification
This commit is contained in:
@ -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([]);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user