尝试更新购物车产品的数量。但是,只有购物车的最后一个元素正在更新,其他产品没有更新,其他产品的数量与最后一个相同。
getTopLevelNodes(slotNodes, parentElement) {
console.log(slotNodes);
const topSlotNodes = [];
slotNodes.forEach((element) => {
const parent = element.parentElement.nodeName;
if (parent === parentElement) {
topSlotNodes.push(element);
}
});
return topSlotNodes;
}
Blade.php在一个foreach循环中
public function update_cart(Request $request,$Fid)
{
$data5=array();
$data5['qty']=$request->qty;
//print_r($data5['qty']);
DB::table('cart')
->where('Fid',$Fid)
->update($data5);
return redirect('/customer_show_cart');
}