Files
sam-api/app/Http/Requests/Leave/IndexRequest.php

33 lines
1.0 KiB
PHP
Raw Normal View History

<?php
namespace App\Http\Requests\Leave;
use App\Http\Requests\Traits\HasPagination;
use Illuminate\Foundation\Http\FormRequest;
class IndexRequest extends FormRequest
{
use HasPagination;
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'user_id' => 'nullable|integer',
'status' => 'nullable|string|in:pending,approved,rejected,cancelled',
'leave_type' => 'nullable|string|in:annual,half_am,half_pm,sick,family,maternity,parental',
'date_from' => 'nullable|date',
'date_to' => 'nullable|date|after_or_equal:date_from',
'year' => 'nullable|integer|min:2020|max:2099',
'department_id' => 'nullable|integer',
'sort_by' => 'nullable|string|in:created_at,start_date,end_date,days,status',
'sort_dir' => 'nullable|string|in:asc,desc',
'per_page' => 'nullable|integer|min:1',
'page' => 'nullable|integer|min:1',
];
}
}