- 마이그레이션: is_active 컬럼 추가 (기본값 true) - ItemField 모델: fillable, casts에 is_active 추가 - ItemFieldService: store, storeIndependent, clone, update 메서드에 is_active 처리 - FormRequest: is_active 유효성 검사 규칙 추가 - API Flow 테스트 시나리오 추가 (docs/api-flows/) - docs/INDEX.md에 api-flows 섹션 추가 ModelTrait::scopeActive() 메서드 사용을 위한 필수 컬럼
40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\ItemMaster;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class ItemFieldStoreRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'group_id' => 'nullable|integer|min:1', // 계층번호
|
|
'field_name' => 'required|string|max:255',
|
|
'field_key' => 'nullable|string|max:80|regex:/^[a-zA-Z][a-zA-Z0-9_]*$/',
|
|
'field_type' => 'required|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',
|
|
'is_active' => 'nullable|boolean',
|
|
'is_locked' => 'nullable|boolean',
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'field_key.regex' => __('validation.field_key_format'),
|
|
];
|
|
}
|
|
}
|