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