| 1234567891011121314151617181920212223242526272829303132 |
- <?php
- namespace App\Http\Resources;
- use Illuminate\Http\Request;
- use Illuminate\Http\Resources\Json\JsonResource;
- class CompanyAccountPayableResource extends JsonResource
- {
- public function toArray(Request $request): array
- {
- return [
- 'id' => $this->id,
- 'origin' => $this->origin,
- 'financial_plan_account_id' => $this->financial_plan_account_id,
- 'plan_account' => $this->whenLoaded('planAccount', fn () => $this->planAccount ? [
- 'id' => $this->planAccount->id,
- 'code' => $this->planAccount->code,
- 'description' => $this->planAccount->description,
- ] : null),
- 'history' => $this->history,
- 'value' => (float) $this->value,
- 'paid_value' => (float) $this->paid_value,
- 'discount' => (float) $this->discount,
- 'fine' => (float) $this->fine,
- 'due_date' => $this->due_date?->format('Y-m-d'),
- 'payment_date' => $this->payment_date?->format('Y-m-d'),
- 'status' => $this->status,
- 'obs' => $this->obs,
- ];
- }
- }
|