Добавлена страница штаба
Добавлены графики Добавлены события отчетов
This commit is contained in:
44
app/Events/ReportNurseUpdated.php
Normal file
44
app/Events/ReportNurseUpdated.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use App\Models\ReportNurse;
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ReportNurseUpdated implements ShouldBroadcast
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public function __construct(
|
||||
public ReportNurse $reportNurse,
|
||||
public string $action
|
||||
) {}
|
||||
|
||||
public function broadcastOn(): array
|
||||
{
|
||||
return [new PrivateChannel('headquarters')];
|
||||
}
|
||||
|
||||
public function broadcastAs(): string
|
||||
{
|
||||
return 'report-nurse.updated';
|
||||
}
|
||||
|
||||
public function broadcastWith(): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->reportNurse->id,
|
||||
'department_id' => $this->reportNurse->rf_department_id,
|
||||
'department' => $this->reportNurse->department?->name_short,
|
||||
'action' => $this->action,
|
||||
'period_start' => $this->reportNurse->period_start?->toISOString(),
|
||||
'period_end' => $this->reportNurse->period_end?->toISOString(),
|
||||
'sent_at' => now()->toISOString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user