php - How to reattach multiselect in Laravel 5? -
i have mulutiselect option enabled in select html code, frontend this: 
for example if user unselect option , select other how can update in database, idea?
if have manytomany relationships between group , project can use sync() method maintain association below,
$group->projects()->sync([$projid1, $projid2]); above remove previous association between current group($group) , projects , associates newly supplied projects i.e. $projid1, $projid2.
if want maintain previous associations pass false second argument in sync() below,
$group->projects()->sync([$projid1, $projid2], false); above code maintain previous group , project association , associate passed projects.
Comments
Post a Comment