onQueue(config('restaurant-delivery.queue.queues.notifications', 'restaurant-delivery-notifications')); } /** * Get the notification's delivery channels. */ public function via(object $notifiable): array { return ['database']; } /** * Get the array representation of the notification. */ public function toArray(object $notifiable): array { return [ 'type' => 'new_delivery_request', 'delivery_id' => $this->delivery->id, 'tracking_code' => $this->delivery->tracking_code, 'restaurant_name' => $this->delivery->restaurant_name, 'pickup_address' => $this->delivery->pickup_address, 'drop_address' => $this->delivery->drop_address, 'distance' => $this->delivery->distance, 'distance_to_pickup' => $this->distance, 'estimated_earnings' => $this->delivery->total_delivery_charge, 'timeout' => $this->timeout, 'is_priority' => $this->delivery->is_priority, ]; } /** * Get FCM data for push notification. */ public function toFcm(): array { $currency = config('restaurant-delivery.pricing.currency_symbol', '৳'); return [ 'title' => 'New Delivery Request', 'body' => "{$this->delivery->restaurant_name} - ".round($this->distance, 1).' km away', 'data' => [ 'type' => 'delivery_request', 'delivery_id' => (string) $this->delivery->id, 'tracking_code' => $this->delivery->tracking_code, 'restaurant_name' => $this->delivery->restaurant_name, 'pickup_address' => $this->delivery->pickup_address, 'drop_address' => $this->delivery->drop_address, 'distance' => (string) $this->delivery->distance, 'distance_to_pickup' => (string) $this->distance, 'earnings' => "{$currency}".number_format((float) $this->delivery->total_delivery_charge, 2), 'timeout' => (string) $this->timeout, 'is_priority' => $this->delivery->is_priority ? 'true' : 'false', ], ]; } }