Support the ongoing development of →
posted 9 years ago
Last updated 1 year ago.

try this :


or for using pivot you can Read this

Last updated 1 year ago.

Haha duh!!

Not sure why I was convinced I had to pass an ID... I guess I needed some sleep. Thanks so much!!

Last updated 1 year ago.

I believe sync does exactly what you're doing:

Using Sync To Attach Many To Many Models

You may also use the sync method to attach related models. The sync method accepts an array of IDs to place on the pivot table. After this operation is complete, only the IDs in the array will be on the intermediate table for the model:


Sign in to participate in this thread!


Your banner here too?

IanSirkit iansirkit Joined 24 Feb 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.