我正在基于php laravel框架进行项目,中间使用laravel购物车5.7时出现错误消息,错误消息为 validation.required
public function add_to_cart(Request $request)
{
$qty = $request->qty;
$product_id = $request->product_id;
$product_info = DB::table('tbl_products')
->where('product_id', $product_id)
->first();
$data['quantity'] = $qty;
$data['id'] = $product_info->product_id;
$data['name'] = $product_info->product_name;
$data['price'] = $product_info->product_price;
$data['attributes']['image'] = $product_info->product_image;
Cart::add($data);
return Redirect::to('/show-card');
}
当我单击此添加到购物车按钮时,它将需要进入购物车页面,但显示错误消息 validation.required
但是当我手动输入网址“ show-cart”时,效果很好