mirror of
https://github.com/ericasch6/scrum-poker-internal.git
synced 2026-10-13 20:12:10 +00:00
Add room participant moderation
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user