sarga/packages/Webkul/Notification/src/Events/UpdateOrderNotification.php

69 lines
1.3 KiB
PHP
Raw Normal View History

2021-12-30 13:30:13 +00:00
<?php
namespace Webkul\Notification\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
2022-03-15 12:02:03 +00:00
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
2021-12-30 13:30:13 +00:00
class UpdateOrderNotification implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
protected $data;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct($data)
{
$this->data = $data;
}
/**
* Get the channels the event should broadcast on.
*
* @return \Illuminate\Broadcasting\Channel|array
*/
public function broadcastOn()
{
return new Channel('notification');
}
2022-03-15 12:02:03 +00:00
/**
2021-12-30 13:30:13 +00:00
* Broadcast with data.
*
* @return array
*/
public function broadcastWith()
{
return $this->data;
}
2022-03-15 12:02:03 +00:00
/**
* Seperate queue.
*
* Command: `php artisan queue:work --queue=broadcastable`
*
* @return string
*/
public function broadcastQueue()
{
2021-12-30 13:30:13 +00:00
return 'broadcastable';
}
/**
* Get the channels the event should broadcast as.
*
2022-03-15 12:02:03 +00:00
* @return string
2021-12-30 13:30:13 +00:00
*/
2022-03-15 12:02:03 +00:00
public function broadcastAs()
{
2021-12-30 13:30:13 +00:00
return 'update-notification';
}
}