UnitReceivableResource.php 1.2 KB

1234567891011121314151617181920212223242526272829303132
  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. 'student_contract_id' => $this->student_contract_id,
  12. 'student_id' => $this->student_id,
  13. 'student_name' => $this->student?->name,
  14. 'type' => $this->type,
  15. 'history' => $this->history,
  16. 'installment_number' => $this->installment_number,
  17. 'total_installments' => $this->total_installments,
  18. 'order' => $this->order,
  19. 'value' => (float) $this->value,
  20. 'paid_value' => (float) $this->paid_value,
  21. 'discount' => (float) $this->discount,
  22. 'fine' => (float) $this->fine,
  23. 'due_date' => $this->due_date?->format('Y-m-d'),
  24. 'payment_date' => $this->payment_date?->format('Y-m-d'),
  25. 'status' => $this->status,
  26. 'asaas_id' => $this->asaas_id,
  27. ];
  28. }
  29. }