Add room participant moderation

This commit is contained in:
2026-09-03 11:35:05 +02:00
parent e30d2e61aa
commit 2f05e56089
14 changed files with 453 additions and 15 deletions
+9 -2
View File
@@ -21,6 +21,7 @@ class RoomStateChanged implements ShouldBroadcastNow
public readonly int $version,
public readonly RoomStateChange $change,
public readonly ?array $state = null,
public readonly ?int $affectedPlayerId = null,
) {}
public function broadcastOn(): Channel
@@ -34,14 +35,20 @@ class RoomStateChanged implements ShouldBroadcastNow
}
/**
* @return array{version: int, change: string, state: array<string, mixed>|null}
* @return array{version: int, change: string, state: array<string, mixed>|null, affected_player_id?: int}
*/
public function broadcastWith(): array
{
return [
$payload = [
'version' => $this->version,
'change' => $this->change->value,
'state' => $this->state,
];
if ($this->affectedPlayerId !== null) {
$payload['affected_player_id'] = $this->affectedPlayerId;
}
return $payload;
}
}