fix(products): keep category when update sends null product_categories_id
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
a443ec3bf6
commit
4f3442190e
@@ -173,6 +173,10 @@ class ProductController extends Controller
|
||||
'features' => 'nullable|array',
|
||||
]);
|
||||
|
||||
if (array_key_exists('product_categories_id', $validated) && $validated['product_categories_id'] === null) {
|
||||
unset($validated['product_categories_id']);
|
||||
}
|
||||
|
||||
if (isset($validated['name']) && $validated['name'] !== $product->name) {
|
||||
$validated['slug'] = Str::slug($validated['name']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user