39 lines
970 B
PHP
39 lines
970 B
PHP
<?php
|
|
|
|
namespace App\Events;
|
|
|
|
use Illuminate\Broadcasting\Channel;
|
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
|
|
use Illuminate\Foundation\Events\Dispatchable;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class DnsSyncCompleted implements ShouldBroadcastNow
|
|
{
|
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
|
|
|
public function __construct(
|
|
public readonly int $synced,
|
|
public readonly array $failedDomains,
|
|
) {}
|
|
|
|
public function broadcastOn(): array
|
|
{
|
|
return [new Channel('admin-notifications')];
|
|
}
|
|
|
|
public function broadcastAs(): string
|
|
{
|
|
return 'dns.sync.completed';
|
|
}
|
|
|
|
public function broadcastWith(): array
|
|
{
|
|
return [
|
|
'synced' => $this->synced,
|
|
'failed_domains' => $this->failedDomains,
|
|
'message' => "Đã đồng bộ {$this->synced} bản ghi DNS từ Plesk",
|
|
];
|
|
}
|
|
}
|