Files
kaunter/app/Events/NotifikasiAnggota.php
nurafrinaalimi16 b8cc3f38cc fix komen pusher
2025-11-17 15:50:12 +08:00

47 lines
1.1 KiB
PHP

<?php
namespace App\Events;
use Illuminate\Queue\SerializesModels;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
class NotifikasiAnggota implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $nokp;
public $status; // DILULUSKAN atau DITOLAK
public $komen;
public $tagoperasi;
public function __construct($nokp, $status, $komen, $tagoperasi = null)
{
$this->nokp = $nokp;
$this->status = strtoupper($status); // pastikan huruf besar DILULUSKAN/DITOLAK
$this->komen = $komen;
$this->tagoperasi = $tagoperasi;
}
public function broadcastOn()
{
return ['notice-anggota'];
}
public function broadcastAs()
{
return 'my-anggota';
}
public function broadcastWith()
{
return [
'noic' => $this->nokp,
'status' => $this->status, // ikut format API updateAnggota
'komen' => $this->komen,
'tagoperasi' => $this->tagoperasi,
];
}
}