UnitReceivableResource.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Request;
  4. use Illuminate\Http\Resources\Json\JsonResource;
  5. class UnitReceivableResource extends JsonResource
  6. {
  7. public function toArray(Request $request): array
  8. {
  9. return [
  10. 'id' => $this->id,
  11. 'source' => 'installment',
  12. 'student_contract_id' => $this->student_contract_id,
  13. 'student_id' => $this->student_id,
  14. 'student_name' => $this->student?->name,
  15. 'type' => $this->type,
  16. 'history' => $this->history,
  17. 'installment_number' => $this->installment_number,
  18. 'total_installments' => $this->total_installments,
  19. 'order' => $this->order,
  20. 'value' => (float) $this->value,
  21. 'paid_value' => (float) $this->paid_value,
  22. 'discount' => (float) $this->discount,
  23. 'fine' => (float) $this->fine,
  24. 'due_date' => $this->due_date?->format('Y-m-d'),
  25. 'payment_date' => $this->payment_date?->format('Y-m-d'),
  26. 'status' => $this->status,
  27. 'asaas_id' => $this->asaas_id,
  28. 'invoice_url' => $this->invoice_url,
  29. 'billing_type' => $this->billing_type,
  30. 'asaas_status' => $this->asaas_status,
  31. ];
  32. }
  33. }