2025-11-20 16:55:57 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Requests\ItemMaster;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
|
|
|
|
|
class ItemFieldUpdateRequest extends FormRequest
|
|
|
|
|
{
|
|
|
|
|
public function authorize(): bool
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function rules(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'field_name' => 'sometimes|string|max:255',
|
2025-11-28 17:39:14 +09:00
|
|
|
'field_key' => 'nullable|string|max:80|regex:/^[a-zA-Z][a-zA-Z0-9_]*$/',
|
2025-11-20 16:55:57 +09:00
|
|
|
'field_type' => 'sometimes|in:textbox,number,dropdown,checkbox,date,textarea',
|
|
|
|
|
'is_required' => 'nullable|boolean',
|
|
|
|
|
'default_value' => 'nullable|string',
|
|
|
|
|
'placeholder' => 'nullable|string|max:255',
|
|
|
|
|
'display_condition' => 'nullable|array',
|
|
|
|
|
'validation_rules' => 'nullable|array',
|
|
|
|
|
'options' => 'nullable|array',
|
|
|
|
|
'properties' => 'nullable|array',
|
2025-12-05 14:40:09 +09:00
|
|
|
'is_active' => 'nullable|boolean',
|
2025-11-28 17:39:14 +09:00
|
|
|
'is_locked' => 'nullable|boolean',
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function messages(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'field_key.regex' => __('validation.field_key_format'),
|
2025-11-20 16:55:57 +09:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|