Files
Leantime/app/Domain/Notifications/Controllers/GetLatestGrowl.php
wangruiguo d647428529
Some checks failed
Security Audit / Composer Security Audit (push) Has been cancelled
Security Audit / NPM Security Audit (push) Has been cancelled
Security Audit / CodeQL Analysis (push) Has been cancelled
OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)
2026-09-03 18:49:20 +08:00

36 lines
993 B
PHP

<?php
/**
* GetLatestGrowl Controller - returns the latest pending growl notification.
*/
namespace Leantime\Domain\Notifications\Controllers;
use Leantime\Core\Controller\Controller;
use Leantime\Domain\Notifications\Services\Notifications as NotificationService;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
class GetLatestGrowl extends Controller
{
private NotificationService $notificationService;
/**
* init - inject dependencies
*/
public function init(NotificationService $notificationService): void
{
$this->notificationService = $notificationService;
}
/**
* get - returns the latest pending growl notification as JSON, or false when none.
*/
public function get(array $params = []): Response
{
$payload = $this->notificationService->consumeFlashNotification();
return new JsonResponse($payload !== null ? json_encode($payload) : false);
}
}