Files
radicall/app/Http/Resources/Client/InvoiceResource.php
T

28 lines
789 B
PHP

<?php
namespace App\Http\Resources\Client;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class InvoiceResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'number' => $this->number,
'amount' => $this->amount,
'status' => $this->status,
'payment_method' => $this->payment_method,
'paid_at' => $this->paid_at,
'created_at' => $this->created_at,
'document' => $this->whenLoaded('document', fn () => [
'id' => $this->document->id,
'code' => $this->document->code,
'modality' => $this->document->modality,
]),
];
}
}