forked from admin/services_core
37 lines
1.3 KiB
PHP
37 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Wilayah;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class IndexWilayahRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
/** Pencarian berdasarkan kode atau nama wilayah. */
|
|
'search' => ['nullable', 'string', 'max:255'],
|
|
/** Filter kabupaten berdasarkan provinsi. */
|
|
'provinsi_id' => ['nullable', 'integer', 'exists:wilayah_provinsi,id'],
|
|
/** Filter kecamatan berdasarkan kabupaten. */
|
|
'kabupaten_id' => ['nullable', 'integer', 'exists:wilayah_kabupaten,id'],
|
|
/** Filter desa berdasarkan kecamatan. */
|
|
'kecamatan_id' => ['nullable', 'integer', 'exists:wilayah_kecamatan,id'],
|
|
/** Nomor halaman. */
|
|
'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', 'kode', 'nama', 'created_at'])],
|
|
/** Arah pengurutan data. */
|
|
'sort_direction' => ['nullable', Rule::in(['asc', 'desc'])],
|
|
];
|
|
}
|
|
}
|