UnitAccountReceivableResource.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Request;
  4. use Illuminate\Http\Resources\Json\JsonResource;
  5. /**
  6. * Recebível avulso (manual) da unidade, normalizado com os mesmos campos das
  7. * parcelas de aluno para conviver na mesma listagem de Contas a Receber.
  8. */
  9. class UnitAccountReceivableResource extends JsonResource
  10. {
  11. public function toArray(Request $request): array
  12. {
  13. return [
  14. 'id' => $this->id,
  15. 'source' => 'manual',
  16. 'student_contract_id' => null,
  17. 'student_id' => $this->student_id,
  18. 'student_name' => $this->student?->name,
  19. 'financial_plan_account_id' => $this->financial_plan_account_id,
  20. 'type' => 'manual',
  21. 'history' => $this->history,
  22. 'installment_number' => null,
  23. 'total_installments' => null,
  24. 'order' => null,
  25. 'value' => (float) $this->value,
  26. 'paid_value' => (float) $this->paid_value,
  27. 'discount' => (float) $this->discount,
  28. 'fine' => (float) $this->fine,
  29. 'due_date' => $this->due_date?->format('Y-m-d'),
  30. 'payment_date' => $this->payment_date?->format('Y-m-d'),
  31. 'status' => $this->status,
  32. 'obs' => $this->obs,
  33. 'asaas_id' => null,
  34. 'invoice_url' => null,
  35. 'billing_type' => null,
  36. 'asaas_status' => null,
  37. ];
  38. }
  39. }