21 lines
383 B
PHP
21 lines
383 B
PHP
<?php
|
|
|
|
namespace App\Service;
|
|
|
|
use Symfony\Component\Mercure\HubInterface;
|
|
use Symfony\Component\Mercure\Update;
|
|
|
|
class NotificationService
|
|
{
|
|
public function __construct(private HubInterface $hub)
|
|
{
|
|
|
|
}
|
|
|
|
public function sendUpdate(mixed $data): void
|
|
{
|
|
$update = new Update('notification', json_encode($data));
|
|
$this->hub->publish($update);
|
|
}
|
|
}
|