Files
sam-api/app/Http/Requests/Api/V1/ModelFormula/UpdateModelFormulaRequest.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

70 lines
2.0 KiB
PHP

<?php
namespace App\Http\Requests\Api\V1\ModelFormula;
use Illuminate\Foundation\Http\FormRequest;
class UpdateModelFormulaRequest 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:100'],
'target_parameter' => ['sometimes', 'string', 'max:50', 'regex:/^[a-zA-Z][a-zA-Z0-9_]*$/'],
'expression' => ['sometimes', 'string', 'max:1000'],
'description' => ['nullable', 'string', 'max:500'],
'is_active' => ['sometimes', 'boolean'],
'execution_order' => ['sometimes', 'integer', 'min:0'],
];
}
/**
* Get custom messages for validator errors.
*/
public function messages(): array
{
return [
'target_parameter.regex' => __('validation.model_formula.target_parameter_format'),
];
}
/**
* Get custom attribute names for validator errors.
*/
public function attributes(): array
{
return [
'name' => __('validation.attributes.formula_name'),
'target_parameter' => __('validation.attributes.target_parameter'),
'expression' => __('validation.attributes.formula_expression'),
'description' => __('validation.attributes.description'),
'is_active' => __('validation.attributes.is_active'),
'execution_order' => __('validation.attributes.execution_order'),
];
}
/**
* Prepare the data for validation.
*/
protected function prepareForValidation(): void
{
if ($this->has('is_active')) {
$this->merge(['is_active' => $this->boolean('is_active')]);
}
if ($this->has('execution_order')) {
$this->merge(['execution_order' => $this->integer('execution_order')]);
}
}
}