*/ public function broadcastOn(): array { return [new Channel('room.1')]; } /** * 广播事件名(前端监听 .baccarat.opened)。 */ public function broadcastAs(): string { return 'baccarat.opened'; } /** * 广播数据。 * * @return array */ public function broadcastWith(): array { return [ 'round_id' => $this->round->id, 'bet_opens_at' => $this->round->bet_opens_at->toIso8601String(), 'bet_closes_at' => $this->round->bet_closes_at->toIso8601String(), 'bet_seconds' => (int) now()->diffInSeconds($this->round->bet_closes_at), ]; } }