mirror of
https://github.com/ProxyPanel/ProxyPanel.git
synced 2026-04-03 02:58:42 +00:00
32 lines
746 B
PHP
32 lines
746 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 UserVNetTasks implements ShouldBroadcastNow
|
|
{
|
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
|
|
|
public function __construct(
|
|
public string $type,
|
|
public array $data = [],
|
|
public ?int $userId = null
|
|
) {
|
|
}
|
|
|
|
public function broadcastOn(): Channel
|
|
{
|
|
return new Channel('user.'.$this->type.'.'.($this->userId ?? 'all'));
|
|
}
|
|
|
|
public function broadcastAs(): string
|
|
{
|
|
return 'user.vnet.tasks';
|
|
}
|
|
}
|