*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'purchase_order_id' => $this->purchase_order_id, 'purchase_order' => new PurchaseOrderResource($this->whenLoaded('purchaseOrder')), 'warehouse_id' => $this->warehouse_id, 'warehouse' => new WarehouseResource($this->whenLoaded('warehouse')), 'receipt_number' => $this->receipt_number, 'receipt_date' => $this->receipt_date, 'status' => $this->status, 'notes' => $this->notes, 'lines' => GoodsReceiptLineResource::collection($this->whenLoaded('lines')), 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]; } }