*/ public function broadcastOn(): array { return [ new Channel('room.1'), ]; } /** * 广播事件名。 */ public function broadcastAs(): string { return 'holiday.started'; } /** * 广播数据:供前端构建弹窗和公屏消息。 * * @return array */ public function broadcastWith(): array { return [ 'event_id' => $this->event->id, 'name' => $this->event->name, 'description' => $this->event->description, 'total_amount' => $this->event->total_amount, 'max_claimants' => $this->event->max_claimants, 'distribute_type' => $this->event->distribute_type, 'fixed_amount' => $this->event->fixed_amount, 'claimed_count' => $this->event->claimed_count, 'expires_at' => $this->event->expires_at?->toIso8601String(), ]; } }