It looks like your array is showing a hasMany relationship. Hub has many data. If you define this in your models and set up an appropriate table then eloquent will deal with the save for you. Look at for info


i have the relation working fine, im trying here to update the data on change

5 days ago (993,535 XP)

How would you save the data when you would have the exactly the same data array as me ?

How do you want the result to look? You gave us the array, now describe what the output looks like

As it stands, the problem cannot be solved because you have two things to save and only one place to put them


@petritr can you show your model so i can understand the relationship you've set up? Feels like (if you are using a join table) then you can use sync()


$hub->data()->sync([1, 2, 3]);

Please sign in or create an account to participate in this conversation.