1
0
mirror of https://github.com/freescout-helpdesk/freescout.git synced 2024-11-25 20:02:30 +01:00
freescout/app/Channels/RealtimeBroadcastChannel.php
2018-11-12 09:12:57 +00:00

30 lines
852 B
PHP

<?php
namespace App\Channels;
use App\Events\RealtimeBroadcastNotificationCreated;
use Illuminate\Notifications\Channels\BroadcastChannel;
use Illuminate\Notifications\Notification;
class RealtimeBroadcastChannel extends BroadcastChannel
{
/**
* Send the given notification immediately using non-quable event.
*
* @param mixed $notifiable
* @param \Illuminate\Notifications\Notification $notification
*
* @return array|null
*/
public function send($notifiable, Notification $notification)
{
$message = $this->getData($notifiable, $notification);
$event = new RealtimeBroadcastNotificationCreated(
$notifiable, $notification, is_array($message) ? $message : $message->data
);
return $this->events->dispatch($event);
}
}