mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-04 10:42:23 +00:00
Move the shared team id and team channel logic of 15 broadcast events into a BroadcastsToTeam trait. Events no longer fall back to the session team: the session team can differ from the resource team, and queued jobs have no session. Fix StopDatabaseProxy, which dispatched DatabaseProxyStopped without a team, so the event was never broadcast from queued jobs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
848 B
PHP
36 lines
848 B
PHP
<?php
|
|
|
|
namespace App\Events;
|
|
|
|
use App\Traits\BroadcastsToTeam;
|
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
|
use Illuminate\Foundation\Events\Dispatchable;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class ServerValidated implements ShouldBroadcast
|
|
{
|
|
use BroadcastsToTeam, Dispatchable, InteractsWithSockets, SerializesModels;
|
|
|
|
public ?string $serverUuid = null;
|
|
|
|
public function __construct(?int $teamId, ?string $serverUuid = null)
|
|
{
|
|
$this->teamId = $teamId;
|
|
$this->serverUuid = $serverUuid;
|
|
}
|
|
|
|
public function broadcastAs(): string
|
|
{
|
|
return 'ServerValidated';
|
|
}
|
|
|
|
public function broadcastWith(): array
|
|
{
|
|
return [
|
|
'teamId' => $this->teamId,
|
|
'serverUuid' => $this->serverUuid,
|
|
];
|
|
}
|
|
}
|