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]);
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire