mardi 30 avril 2019

Duplicate the categories of product

I need to copy the categories pivot for product id 15 and apply to another product. Is there any shorthand to do the copy paste instead of getting the array and attach loop throgh?

$product = App\Product::find(15);

$product->categories()->attach([1, 5]);



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2WaFcI8
via IFTTT

Aucun commentaire:

Enregistrer un commentaire