<?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([]); } }