Files
onboard/app/Events/PatientDataChanged.php
brusnitsyn 0a882b0cb2 Добавлена страница штаба
Добавлены графики
Добавлены события отчетов
2026-05-31 21:57:21 +09:00

43 lines
1.1 KiB
PHP

<?php
namespace App\Events;
use App\Models\DepartmentPatient;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class PatientDataChanged implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public function __construct(
public DepartmentPatient $patient,
public string $action
) {}
public function broadcastOn(): array
{
return [new PrivateChannel('headquarters')];
}
public function broadcastAs(): string
{
return 'patient.changed';
}
public function broadcastWith(): array
{
return [
'id' => $this->patient->department_patient_id,
'department_id' => $this->patient->rf_department_id,
'full_name' => $this->patient->full_name,
'action' => $this->action,
'is_current' => $this->patient->is_current,
'changed_at' => now()->toISOString(),
];
}
}