33 lines
1.1 KiB
PHP
33 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Tenant;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class IndexTenantRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
/** Kata kunci untuk mencari kode, nama, atau email tenant. */
|
|
'search' => ['nullable', 'string', 'max:255'],
|
|
/** Filter status tenant. */
|
|
'status' => ['nullable', Rule::in(['active', 'inactive'])],
|
|
/** 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', 'tenant_code', 'tenant_name', 'email', 'status', 'created_at'])],
|
|
/** Arah pengurutan data. */
|
|
'sort_direction' => ['nullable', Rule::in(['asc', 'desc'])],
|
|
];
|
|
}
|
|
}
|