Files
sam-api/app/Http/Requests/Api/V1/ModelParameter/CreateModelParameterRequest.php
kent bf8036a64b feat: DB 연결 오버라이딩 및 대시보드 통계 위젯 추가
- DB 연결: 로컬/Docker 환경 오버라이딩 설정 (.env)
- 테넌트 위젯: redirect 버그 수정 (TenantSelectorWidget)
- 통계 위젯: 사용자/제품/자재/주문 카드 추가 (StatsOverviewWidget)
- 리소스 한국어화: Product, Material 모델 레이블 추가
- 대시보드: 위젯 등록 및 캐시 최적화

🤖 Generated with [Claude Code](https://claude.ai/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-30 23:31:14 +09:00

83 lines
2.9 KiB
PHP

<?php
namespace App\Http\Requests\Api\V1\ModelParameter;
use Illuminate\Foundation\Http\FormRequest;
class CreateModelParameterRequest 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' => ['required', 'string', 'max:50', 'regex:/^[a-zA-Z][a-zA-Z0-9_]*$/'],
'label' => ['required', 'string', 'max:100'],
'type' => ['required', 'string', 'in:INPUT,OUTPUT'],
'data_type' => ['required', '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' => ['boolean'],
'display_order' => ['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
{
$this->merge([
'is_required' => $this->boolean('is_required'),
'display_order' => $this->integer('display_order', 0),
]);
}
}