33 lines
1.0 KiB
PHP
33 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class GoodsReceiptResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
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,
|
|
];
|
|
}
|
|
}
|