Support the ongoing development of Laravel.io →
Input Database Forms
Last updated 2 years ago.
0

It doesn't look like you have the associations setup properly. Instead of your current method, you should build an array where you have ['checkedID'=>'number'] and then just do a foreach loop to update the rows:

foreach ($arr as $id => $number) Products::where('id',$id)->update(['number'=>$number])
0

jeremybalog said:

It doesn't look like you have the associations setup properly. Instead of your current method, you should build an array where you have ['checkedID'=>'number'] and then just do a foreach loop to update the rows:

foreach ($arr as $id => $number) Products::where('id',$id)->update(['number'=>$number])

Thanks a lot, this has worked for me in the end after playing around with the arrays!

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Hardist hardist Joined 26 May 2015

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.