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>
This commit is contained in:
81
app/Http/Requests/BomResolveRequest.php
Normal file
81
app/Http/Requests/BomResolveRequest.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class BomResolveRequest 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 [
|
||||
'model_id' => 'required|integer|exists:models,id',
|
||||
'parameters' => 'required|array',
|
||||
'parameters.*' => 'required',
|
||||
'preview_only' => 'boolean',
|
||||
'use_cache' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom messages for validator errors.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'model_id.required' => __('error.model_id_required'),
|
||||
'model_id.exists' => __('error.model_not_found'),
|
||||
'parameters.required' => __('error.parameters_required'),
|
||||
'parameters.array' => __('error.parameters_must_be_array'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the validator instance.
|
||||
*/
|
||||
public function withValidator($validator): void
|
||||
{
|
||||
$validator->after(function ($validator) {
|
||||
$this->validateParameters($validator);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 매개변수 검증
|
||||
*/
|
||||
private function validateParameters($validator): void
|
||||
{
|
||||
if (!$this->input('model_id') || !$this->input('parameters')) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$parameterService = new \App\Services\ModelParameterService();
|
||||
$errors = $parameterService->validateParameterValues(
|
||||
$this->input('model_id'),
|
||||
$this->input('parameters')
|
||||
);
|
||||
|
||||
if (!empty($errors)) {
|
||||
foreach ($errors as $paramName => $paramErrors) {
|
||||
foreach ($paramErrors as $error) {
|
||||
$validator->errors()->add("parameters.{$paramName}", $error);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
$validator->errors()->add('parameters', __('error.parameter_validation_failed'));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user