improve the way linked categories are copied
This commit is contained in:
parent
3aeb0c75df
commit
69dea2b8b3
|
|
@ -662,7 +662,10 @@ class ProductRepository extends Repository
|
|||
|
||||
if (! in_array('categories', $attributesToSkip)) {
|
||||
foreach ($originalProduct->categories as $category) {
|
||||
$copiedProduct->categories()->save($category->replicate());
|
||||
DB::table('product_categories')->insert([
|
||||
'product_id' => $copiedProduct->id,
|
||||
'category_id' => $category->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue