I have this request
"products":[
{
"quantity_accepted":15,
},
{
"quantity_accepted":17,
},
{
"quantity_accepted":17
}
]
In my controller am trying to iterate and store each object in that array
foreach($request->get('products') as $product){
ItemOrder::where('purchase_order_id',$id)
->update([
'quantity_accepted'=>$product['quantity_accepted'],
]);
}
i am only able to store one of the objects which is the last one
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire