Files
alrahma_sunday_school_api/app/Http/Requests/Refunds/RefundIndexRequest.php
T
2026-06-09 01:25:14 -04:00

39 lines
1.3 KiB
PHP

<?php
namespace App\Http\Requests\Refunds;
use App\Http\Requests\ApiFormRequest;
use App\Models\Refund;
class RefundIndexRequest extends ApiFormRequest
{
public function authorize(): bool
{
return $this->user() !== null;
}
public function rules(): array
{
return [
'status' => ['nullable', 'string', 'in:'.implode(',', [
Refund::STATUS_PENDING,
Refund::STATUS_APPROVED,
Refund::STATUS_PARTIAL,
Refund::STATUS_PAID,
Refund::STATUS_REJECTED,
Refund::STATUS_CANCELED,
])],
'request' => ['nullable', 'string', 'in:tuition,overpayment,duplicate,extra'],
'parent_id' => ['nullable', 'integer', 'min:1'],
'invoice_id' => ['nullable', 'integer', 'min:1'],
'school_year' => ['nullable', 'string', 'max:20'],
'semester' => ['nullable', 'string', 'max:20'],
'q' => ['nullable', 'string', 'max:200'],
'page' => ['nullable', 'integer', 'min:1'],
'per_page' => ['nullable', 'integer', 'min:1', 'max:200'],
'sort_by' => ['nullable', 'string', 'in:created_at,updated_at,refund_amount,status,parent_id,invoice_id'],
'sort_dir' => ['nullable', 'string', 'in:asc,desc'],
];
}
}