Edit File: OrderDetailsResource.php
<?php namespace App\Http\Resources\Api\Provider\UnPricingOrders; use App\Http\Resources\Api\User\UnPricingOrders\InvoiceResource; use Carbon\Carbon; use Illuminate\Http\Resources\Json\JsonResource; class OrderDetailsResource extends JsonResource { public function toArray($request) { return [ 'id' => $this->id, 'order_num' => $this->order_num, 'order_time' => Carbon::parse($this->created_at)->format('h:i A'), 'order_call_type' => 'negotiation', 'order_date' => Carbon::parse($this->created_at)->diffForHumans(), 'user' => [ 'name' => $this->user?->name, 'image' => $this->user?->image, 'avg_rates' => number_format($this->user?->avg_rates ?? 0, 2), 'lat' => $this->lat, 'lng' => $this->lng, 'map_desc' => $this->map_desc, ], 'product' => [ 'name' => $this?->product?->name, 'description' => $this?->product?->description, 'image' => $this?->product?->productImages()?->first()?->image ?? null, 'quantity' => $this->quantity, ], 'order_info' => [ 'status' => $this?->status, 'receiving_method' => $this->receiving_method, // When Order is Scheduled 'schedule_execution_date' => $this?->schedule_execution_date, 'schedule_execution_time' => $this?->schedule_execution_time, 'order_type' => [ 'slug' => $this?->order_type, 'text' => __('order.order_type.' . $this->order_type), ], // When Receiving in Store 'car_color' => $this?->car_color, 'car_model' => $this?->car_model, 'car_plat_number' => $this?->car_plat_number, 'notes' => $this?->notes, 'receiving_in_store_notes' => $this?->receiving_in_store_notes, 'created_at' => $this->created_at->translatedFormat('j F Y'), 'created_at_time' => Carbon::parse($this->created_at)->isoFormat('h:mm A'), ], 'invoice' => InvoiceResource::make($this->latestInvoice), 'live_call' => [ 'api_key' => $this->api_key, 'session_id' => $this->session_id, 'token' => $this->token, 'secret_key' => $this->secret_key, ], 'room_id' => $this->room_id ]; } }
Back to File Manager