| 123456789101112131415161718192021222324252627282930 |
- <?php
- namespace App\Http\Resources;
- use Carbon\Carbon;
- use Illuminate\Http\Request;
- use Illuminate\Http\Resources\Json\JsonResource;
- class StudentContractInstallmentResource extends JsonResource
- {
- public function toArray(Request $request): array
- {
- return [
- 'id' => $this->id,
- 'type' => $this->type,
- 'history' => $this->history,
- 'order' => $this->order, // "1/12" via accessor
- 'installment_number' => $this->installment_number,
- 'total_installments' => $this->total_installments,
- 'value' => (float) $this->value,
- 'paid_value' => (float) $this->paid_value,
- 'discount' => (float) $this->discount,
- 'fine' => (float) $this->fine,
- 'due_date' => $this->due_date
- ? Carbon::parse($this->due_date)->format('d/m/Y')
- : null,
- 'status' => $this->status,
- ];
- }
- }
|