This commit is contained in:
pbao9
2026-02-06 20:52:59 +07:00
parent d7aadf7544
commit e7b9ce7485
17 changed files with 570 additions and 36 deletions
+34 -5
View File
@@ -49,6 +49,9 @@ class ProductRequest extends FormRequest
],
'short_description' => ['nullable', 'string', 'max:255'],
'description' => ['nullable', 'string'],
'thumbnail' => ['nullable', 'string', 'max:255'],
'gallery' => ['nullable', 'array'],
'gallery.*' => ['nullable', 'string', 'max:255'],
'stock' => ['nullable', 'integer', 'min:0'],
'is_unlimited' => ['boolean'],
'cpu' => ['nullable', 'string', 'max:255'],
@@ -64,11 +67,23 @@ class ProductRequest extends FormRequest
'is_active' => ['boolean'],
'sort_order' => ['nullable', 'integer'],
'published_at' => ['nullable', 'date'],
// OS versions (pivot table os_product)
// OS versions (pivot table os_product) - for VPS
'os_ids' => ['nullable', 'array'],
'os_ids.*' => ['exists:os,id'],
// Control Panels (pivot table product_control_panel) - for Hosting
'control_panel_ids' => ['nullable', 'array'],
'control_panel_ids.*' => ['exists:control_panels,id'],
'control_panel_price_modifiers' => ['nullable', 'array'],
'control_panel_price_modifiers.*' => ['nullable', 'numeric', 'min:0'],
'control_panel_default' => ['nullable', 'exists:control_panels,id'],
// Images
'thumbnail' => ['nullable', 'string', 'max:255'],
'gallery' => ['nullable', 'array'],
'gallery.*' => ['nullable', 'string', 'max:255'],
// Pricing cycles (table product_pricings)
'pricing' => ['nullable', 'array'],
];
@@ -127,7 +142,14 @@ class ProductRequest extends FormRequest
'short_description.max' => 'Mô tả ngắn không được vượt quá 255 ký tự.',
'description.string' => 'Mô tả phải là chuỗi ký tự.',
'thumbnail.string' => 'Đường dẫn ảnh đại diện phải là chuỗi ký tự.',
'thumbnail.max' => 'Đường dẫn ảnh đại diện không được vượt quá 255 ký tự.',
'gallery.array' => 'Thư viện ảnh không hợp lệ.',
'gallery.*.string' => 'Đường dẫn ảnh trong thư viện phải là chuỗi ký tự.',
'gallery.*.max' => 'Đường dẫn ảnh trong thư viện không được vượt quá 255 ký tự.',
'stock.integer' => 'Số lượng tồn kho phải là số nguyên.',
'stock.min' => 'Số lượng tồn kho không được âm.',
@@ -168,7 +190,14 @@ class ProductRequest extends FormRequest
'os_ids.array' => 'Danh sách hệ điều hành không hợp lệ.',
'os_ids.*.exists' => 'Hệ điều hành được chọn không tồn tại.',
'control_panel_ids.array' => 'Danh sách Control Panel không hợp lệ.',
'control_panel_ids.*.exists' => 'Control Panel được chọn không tồn tại.',
'control_panel_price_modifiers.array' => 'Danh sách phụ phí Control Panel không hợp lệ.',
'control_panel_price_modifiers.*.numeric' => 'Phụ phí Control Panel phải là số.',
'control_panel_price_modifiers.*.min' => 'Phụ phí Control Panel không được âm.',
'control_panel_default.exists' => 'Control Panel mặc định không tồn tại.',
'pricing.array' => 'Thông tin giá không hợp lệ.',
'pricing.*.price.numeric' => 'Giá phải là số.',
'pricing.*.price.min' => 'Giá không được âm.',