31 lines
647 B
PHP
31 lines
647 B
PHP
<?php
|
|
|
|
namespace App\Events;
|
|
|
|
use Illuminate\Broadcasting\Channel;
|
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
|
|
use Illuminate\Foundation\Events\Dispatchable;
|
|
|
|
class SystemStatsBroadcast implements ShouldBroadcastNow
|
|
{
|
|
use Dispatchable, InteractsWithSockets;
|
|
|
|
public function __construct(public array $stats) {}
|
|
|
|
public function broadcastOn(): array
|
|
{
|
|
return [new Channel('fox')];
|
|
}
|
|
|
|
public function broadcastAs(): string
|
|
{
|
|
return 'stats.system';
|
|
}
|
|
|
|
public function broadcastWith(): array
|
|
{
|
|
return $this->stats;
|
|
}
|
|
}
|