52 lines
1.2 KiB
PHP
52 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Events;
|
|
|
|
use Illuminate\Broadcasting\Channel;
|
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
|
use Illuminate\Broadcasting\PresenceChannel;
|
|
use Illuminate\Broadcasting\PrivateChannel;
|
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
|
|
use Illuminate\Foundation\Events\Dispatchable;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use App\Models\Antrian;
|
|
|
|
class AntrianDipanggil implements ShouldBroadcastNow
|
|
{
|
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
|
|
|
public $antrian;
|
|
|
|
/**
|
|
* Create a new event instance.
|
|
*/
|
|
public function __construct(Antrian $antrian)
|
|
{
|
|
$this->antrian = $antrian;
|
|
}
|
|
|
|
/**
|
|
* Get the channels the event should broadcast on.
|
|
*
|
|
* @return array<int, \Illuminate\Broadcasting\Channel>
|
|
*/
|
|
public function broadcastOn(): array
|
|
{
|
|
return [
|
|
new Channel('antrian-display'),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the data to broadcast.
|
|
*/
|
|
public function broadcastWith(): array
|
|
{
|
|
return [
|
|
'poli_name' => $this->antrian->poli->nama_poli,
|
|
'queue_number' => $this->antrian->no_antrian,
|
|
'antrian_id' => $this->antrian->id
|
|
];
|
|
}
|
|
}
|