HEX
Server: nginx/1.24.0
System: Linux DGT-WORDPRESS-VM-SERVER 6.14.0-1017-azure #17~24.04.1-Ubuntu SMP Mon Dec 1 20:10:50 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 8.4.12
Disabled: NONE
Upload Files
File: /mnt/data/ghayatcom/ghayatcom-api/app/Http/Resources/LabOrderResource.php
<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class LabOrderResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */

    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'user_id' => $this->user_id,
            'sample_collection_address_id' => $this->sample_collection_address_id,
            'lab_id' => $this->lab_id,
            'appointment_id' => $this->appointment_id,
            'date' => $this->date,
            'time' => $this->time,
            'payment_method' => $this->payment_method,
            'token' => $this->token,
            'subtotal' => $this->subtotal,
            'tax' => $this->tax,
            'final_total' => $this->final_total,
            'status' => $this->status,
            'orderplace_date' => $this->orderplace_date,
            'reject_time' => $this->reject_time,
            'reject_description' => $this->reject_description,
            'lab_report_path' => $this->lab_report_path,
            'lab_report_url' => $this->lab_report_url,
            'lab_report' => $this->documents ?? null,
            'review' => $this->review,
            'user' => new UserResource($this->whenLoaded('user')),
            'order_data' => LabOrderDataResource::collection($this->whenLoaded('orderData')),
            'address' => new AddressResource($this->whenLoaded('address')),
            'lab_name' => $this->lab->name ?? null,
            'qrcode' => $this->qrcode ?? null,
        ];
    }
}