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:
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api\V1\BomResolver;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CreateProductFromModelRequest 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', 'min:1'],
|
||||
'input_parameters' => ['required', 'array', 'min:1'],
|
||||
'input_parameters.*' => ['required'],
|
||||
'bom_template_id' => ['sometimes', 'integer', 'min:1'],
|
||||
|
||||
// Product data
|
||||
'product_code' => ['required', 'string', 'max:50', 'regex:/^[A-Z0-9_-]+$/'],
|
||||
'product_name' => ['required', 'string', 'max:100'],
|
||||
'category_id' => ['sometimes', 'integer', 'min:1'],
|
||||
'description' => ['nullable', 'string', 'max:1000'],
|
||||
|
||||
// Product attributes
|
||||
'unit' => ['nullable', 'string', 'max:20'],
|
||||
'min_order_qty' => ['nullable', 'numeric', 'min:0'],
|
||||
'lead_time_days' => ['nullable', 'integer', 'min:0'],
|
||||
'is_active' => ['boolean'],
|
||||
|
||||
// Additional options
|
||||
'create_bom_items' => ['boolean'],
|
||||
'validate_bom' => ['boolean'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom messages for validator errors.
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'product_code.regex' => __('validation.product.code_format'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom attribute names for validator errors.
|
||||
*/
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'model_id' => __('validation.attributes.model_id'),
|
||||
'input_parameters' => __('validation.attributes.input_parameters'),
|
||||
'bom_template_id' => __('validation.attributes.bom_template_id'),
|
||||
'product_code' => __('validation.attributes.product_code'),
|
||||
'product_name' => __('validation.attributes.product_name'),
|
||||
'category_id' => __('validation.attributes.category_id'),
|
||||
'description' => __('validation.attributes.description'),
|
||||
'unit' => __('validation.attributes.unit'),
|
||||
'min_order_qty' => __('validation.attributes.min_order_qty'),
|
||||
'lead_time_days' => __('validation.attributes.lead_time_days'),
|
||||
'is_active' => __('validation.attributes.is_active'),
|
||||
'create_bom_items' => __('validation.attributes.create_bom_items'),
|
||||
'validate_bom' => __('validation.attributes.validate_bom'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the data for validation.
|
||||
*/
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
$this->merge([
|
||||
'is_active' => $this->boolean('is_active', true),
|
||||
'create_bom_items' => $this->boolean('create_bom_items', true),
|
||||
'validate_bom' => $this->boolean('validate_bom', true),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user