* * @version 1.0.0 */ class UserHeaderNotification extends Notification { use Queueable; /** * Parámetros para detonar la notificación * * @return void */ public function __construct( public string $message, public string $icon = 'notifications_active', public string $type = 'info', public int $timeout = 15 ) {} /** * Canales de envió de la notificación * * @param mixed $notifiable */ public function via($notifiable) : array { return [ 'broadcast', 'database' ]; } /** * Obtiene la representación del array de la notificación. * * @param mixed $notifiable * * @return array */ public function toArray($notifiable) : array { return [ 'message' => $this->message, 'icon' => $this->icon, 'type' => $this->type, ]; } /** * Manda un mensaje por medio de un broadcast privado */ public function toBroadcast($notifiable) { return new BroadcastMessage([ 'message' => $this->message, 'icon' => $this->type, 'timeout' => $this->timeout ]); } }