Answer the question
In order to leave comments, you need to log in
How to correctly assign a value to a cell of a specific row?
$partnerProductsStatus = PartnerProductsStatus::all();
$data = $request->except('_token');
$partnerProductsStatus[0]->count = $data['many_status'];
$partnerProductsStatus[0]->save();
$partnerProductsStatus[1]->count = $data['average_status'];
$partnerProductsStatus[1]->save();
$partnerProductsStatus[2]->count = $data['few_status'];
$partnerProductsStatus[2]->save();
Answer the question
In order to leave comments, you need to log in
[0], [1], [2] are not id, they are serial numbers in the array.
If you need to change specifically by id, then you need to do something like this:
PartnerProductsStatus::where("id", $id)->update(["count" => $value]);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question