29 lines
738 B
PHP
29 lines
738 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Requests\Approval;
|
||
|
|
|
||
|
|
use App\Models\Tenants\Approval;
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
|
||
|
|
class IndexRequest extends FormRequest
|
||
|
|
{
|
||
|
|
public function authorize(): bool
|
||
|
|
{
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function rules(): array
|
||
|
|
{
|
||
|
|
$statuses = implode(',', Approval::STATUSES);
|
||
|
|
|
||
|
|
return [
|
||
|
|
'status' => "nullable|string|in:{$statuses}",
|
||
|
|
'search' => 'nullable|string|max:100',
|
||
|
|
'sort_by' => 'nullable|string|in:created_at,drafted_at,completed_at,title,status',
|
||
|
|
'sort_dir' => 'nullable|string|in:asc,desc',
|
||
|
|
'per_page' => 'nullable|integer|min:1|max:100',
|
||
|
|
'page' => 'nullable|integer|min:1',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|