Support the ongoing development of Laravel.io →
posted 10 years ago
Eloquent
Last updated 2 years ago.
0

try this :

$user->distlist()->detach();

or for using pivot you can Read this

Last updated 2 years ago.
0

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 2 years ago.
0

I believe sync does exactly what you're doing: http://laravel.com/docs/4.2/eloquent#inserting-related-models

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:

0

Sign in to participate in this thread!

Eventy

Your banner here too?

IanSirkit iansirkit Joined 24 Feb 2014

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.