33 lines
1.0 KiB
PHP
33 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\MenuGroup;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class IndexMenuGroupRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
/** Kata kunci untuk mencari nama atau deskripsi menu group. */
|
|
'search' => ['nullable', 'string', 'max:255'],
|
|
/** Filter status aktif menu group. */
|
|
'is_active' => ['nullable', 'boolean'],
|
|
/** Nomor halaman yang ingin diambil. */
|
|
'page' => ['nullable', 'integer', 'min:1'],
|
|
/** Jumlah data per halaman, maksimal 100. */
|
|
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
|
|
/** Kolom pengurutan data. */
|
|
'sort_by' => ['nullable', Rule::in(['id', 'name', 'description', 'is_active', 'is_system', 'created_at'])],
|
|
/** Arah pengurutan data. */
|
|
'sort_direction' => ['nullable', Rule::in(['asc', 'desc'])],
|
|
];
|
|
}
|
|
}
|