Files
alrahma_sunday_school_api/app/Http/Resources/Refunds/RefundResource.php
T
2026-03-10 23:12:49 -04:00

37 lines
1.5 KiB
PHP

<?php
namespace App\Http\Resources\Refunds;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class RefundResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => (int) ($this->id ?? 0),
'parent_id' => (int) ($this->parent_id ?? 0),
'invoice_id' => $this->invoice_id ? (int) $this->invoice_id : null,
'school_year' => $this->school_year,
'semester' => $this->semester,
'request' => $this->request,
'status' => $this->status,
'reason' => $this->reason,
'refund_amount' => (float) ($this->refund_amount ?? 0),
'refund_paid_amount' => (float) ($this->refund_paid_amount ?? 0),
'refund_method' => $this->refund_method,
'check_nbr' => $this->check_nbr,
'check_file' => $this->check_file,
'note' => $this->note,
'requested_at' => optional($this->requested_at)->toDateTimeString(),
'approved_at' => optional($this->approved_at)->toDateTimeString(),
'refunded_at' => optional($this->refunded_at)->toDateTimeString(),
'created_at' => optional($this->created_at)->toDateTimeString(),
'updated_at' => optional($this->updated_at)->toDateTimeString(),
'parent_name' => $this->parent_name ?? null,
'approved_by_name' => $this->approved_by_name ?? null,
];
}
}