['required', 'string', 'max:255'], 'price' => ['required', 'numeric', 'min:0'], 'price_sale' => ['nullable', 'numeric', 'min:0'], 'description' => ['nullable', 'string'], 'status' => ['required', 'integer'], // Value from Status Enum 'type_id' => ['required', 'integer'], ]; // Infer product type from type_id (Legacy mapping needs to be consistent with Controller) // Controller map: 1=>Addon, 2=>Domain, 3=>Hosting, 4=>VPS // We can access input 'type_id' $typeId = (int) $this->input('type_id'); if ($typeId === 4) { // VPS $rules = array_merge($rules, [ 'cpu' => ['required'], 'ram' => ['required'], 'disk' => ['required'], 'bandwidth' => ['required'], ]); } return $rules; } }