- DB 연결: 로컬/Docker 환경 오버라이딩 설정 (.env) - 테넌트 위젯: redirect 버그 수정 (TenantSelectorWidget) - 통계 위젯: 사용자/제품/자재/주문 카드 추가 (StatsOverviewWidget) - 리소스 한국어화: Product, Material 모델 레이블 추가 - 대시보드: 위젯 등록 및 캐시 최적화 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
86 lines
3.0 KiB
PHP
86 lines
3.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Api\V1\ModelParameter;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class UpdateModelParameterRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'name' => ['sometimes', 'string', 'max:50', 'regex:/^[a-zA-Z][a-zA-Z0-9_]*$/'],
|
|
'label' => ['sometimes', 'string', 'max:100'],
|
|
'type' => ['sometimes', 'string', 'in:INPUT,OUTPUT'],
|
|
'data_type' => ['sometimes', 'string', 'in:INTEGER,DECIMAL,STRING,BOOLEAN'],
|
|
'unit' => ['nullable', 'string', 'max:20'],
|
|
'default_value' => ['nullable', 'string', 'max:255'],
|
|
'min_value' => ['nullable', 'numeric'],
|
|
'max_value' => ['nullable', 'numeric', 'gte:min_value'],
|
|
'enum_values' => ['nullable', 'array'],
|
|
'enum_values.*' => ['string', 'max:100'],
|
|
'validation_rules' => ['nullable', 'string', 'max:500'],
|
|
'description' => ['nullable', 'string', 'max:500'],
|
|
'is_required' => ['sometimes', 'boolean'],
|
|
'display_order' => ['sometimes', 'integer', 'min:0'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom messages for validator errors.
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'name.regex' => __('validation.model_parameter.name_format'),
|
|
'max_value.gte' => __('validation.model_parameter.max_value_gte_min'),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom attribute names for validator errors.
|
|
*/
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'name' => __('validation.attributes.parameter_name'),
|
|
'label' => __('validation.attributes.parameter_label'),
|
|
'type' => __('validation.attributes.parameter_type'),
|
|
'data_type' => __('validation.attributes.data_type'),
|
|
'unit' => __('validation.attributes.unit'),
|
|
'default_value' => __('validation.attributes.default_value'),
|
|
'min_value' => __('validation.attributes.min_value'),
|
|
'max_value' => __('validation.attributes.max_value'),
|
|
'enum_values' => __('validation.attributes.enum_values'),
|
|
'validation_rules' => __('validation.attributes.validation_rules'),
|
|
'description' => __('validation.attributes.description'),
|
|
'is_required' => __('validation.attributes.is_required'),
|
|
'display_order' => __('validation.attributes.display_order'),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Prepare the data for validation.
|
|
*/
|
|
protected function prepareForValidation(): void
|
|
{
|
|
if ($this->has('is_required')) {
|
|
$this->merge(['is_required' => $this->boolean('is_required')]);
|
|
}
|
|
|
|
if ($this->has('display_order')) {
|
|
$this->merge(['display_order' => $this->integer('display_order')]);
|
|
}
|
|
}
|
|
} |