NETBien.backend/app/Events/GlobalNotification.php
2025-06-01 12:32:11 -06:00

54 lines
1.2 KiB
PHP

<?php namespace App\Events;
/**
* @copyright (c) 2025 Notsoweb (https://notsoweb.com) - All rights reserved.
*/
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
/**
* Notificación global
*
* Notificación enviada a todos los usuarios conectados al canal Global.
*
* @author Moisés de Jesús Cortés Castellanos <ing.moisesdejesuscortesc@notsoweb.com>
*
* @version 1.0.0
*/
class GlobalNotification implements ShouldBroadcast
{
use Dispatchable,
InteractsWithSockets,
SerializesModels;
/**
* Constructor
*/
public function __construct(
public string $title,
public string $message,
public string $type = 'info',
public int $timeout = 15
) {}
/**
* Nombre del evento
*/
public function broadcastAs(): string
{
return 'App\Events\Notification';
}
/**
* Canal de envío
*/
public function broadcastOn(): Channel
{
return new PrivateChannel('Global');
}
}