php - How to reattach multiselect in Laravel 5? -


i have mulutiselect option enabled in select html code, frontend this: enter image description here

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

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -