forked from admin/services_core
33 lines
1.0 KiB
PHP
33 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Material;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class IndexMaterialRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
/** Kata kunci untuk mencari barcode atau nama material. */
|
|
'search' => ['nullable', 'string', 'max:255'],
|
|
/** Filter material berdasarkan ID user/teknisi. */
|
|
'user_id' => ['nullable', 'integer', 'exists:users,id'],
|
|
/** Filter jenis material. */
|
|
'type' => ['nullable', Rule::in(['serialized', 'consumable'])],
|
|
/** Filter status material. */
|
|
'status' => ['nullable', 'string', 'max:50'],
|
|
/** Nomor halaman yang ingin diambil. */
|
|
'page' => ['nullable', 'integer', 'min:1'],
|
|
/** Jumlah data per halaman, maksimal 100. */
|
|
'per_page' => ['nullable', 'integer', 'min:1', 'max:100'],
|
|
];
|
|
}
|
|
}
|