delivery->tracking_code}"), new PrivateChannel("restaurant.{$this->delivery->restaurant_id}.deliveries"), ]; if ($this->delivery->rider_id) { $channels[] = new PrivateChannel("rider.{$this->delivery->rider_id}.deliveries"); } return $channels; } /** * Get the data to broadcast. */ public function broadcastWith(): array { return [ 'delivery_id' => $this->delivery->id, 'tracking_code' => $this->delivery->tracking_code, 'status' => $this->delivery->status->value, 'status_label' => $this->delivery->status->label(), 'status_description' => $this->delivery->status->description(), 'status_color' => $this->delivery->status->color(), 'previous_status' => $this->previousStatus?->value, 'rider_id' => $this->delivery->rider_id, 'changed_at' => now()->toIso8601String(), 'metadata' => $this->metadata, ]; } /** * The event's broadcast name. */ public function broadcastAs(): string { return 'delivery.status.changed'; } }