39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Resources\Fournisseur;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class PurchaseOrderResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'fournisseur_id' => $this->fournisseur_id,
|
|
'fournisseur' => $this->whenLoaded('fournisseur'),
|
|
'po_number' => $this->po_number,
|
|
'status' => $this->status,
|
|
'order_date' => $this->order_date ? $this->order_date->format('Y-m-d') : null,
|
|
'expected_date' => $this->expected_date ? $this->expected_date->format('Y-m-d') : null,
|
|
'currency' => $this->currency,
|
|
'total_ht' => $this->total_ht,
|
|
'total_tva' => $this->total_tva,
|
|
'total_ttc' => $this->total_ttc,
|
|
'notes' => $this->notes,
|
|
'delivery_address' => $this->delivery_address,
|
|
'lines' => $this->whenLoaded('lines'),
|
|
'created_at' => $this->created_at,
|
|
'updated_at' => $this->updated_at,
|
|
];
|
|
}
|
|
}
|