Php pakage DarryDecode/cart laravel cart::add()函数不起作用

Php pakage DarryDecode/cart laravel cart::add()函数不起作用,php,laravel,axios,Php,Laravel,Axios,我使用DarryDecode/laravelshoppingcart库的cart::add函数添加购物车中的商品,并通过(axios post请求调用)在购物车中成功添加商品,但当我发布第二次(axios post请求调用)以获取下一个请求购物车中的购物车信息时,购物车为空 获取添加的项目代码(第一次axios调用) 获取返回为空的添加项代码(第二个axios调用) foreach (Cart::getContent() as $item) { if (($current

我使用DarryDecode/laravelshoppingcart库的cart::add函数添加购物车中的商品,并通过(axios post请求调用)在购物车中成功添加商品,但当我发布第二次(axios post请求调用)以获取下一个请求购物车中的购物车信息时,购物车为空

获取添加的项目代码(第一次axios调用)

获取返回为空的添加项代码(第二个axios调用)

foreach (Cart::getContent() as $item) {
            if (($currentItem = Item::with('creator.country_info')->find($item->id))) {
                $itemVat = round($vat * $item->price / 100, 2);
                $subtotal += $item->price - $itemVat;
                $vatTotal += $itemVat;
                $items[] = [
                    'id' => $item->id,
                    'name' => $item->name,
                    'price' => $item->price,
                    'quantity' => $item->quantity,
                    'attributes' => $currentItem
                ];
            }
        }

你成功修复了吗?我正在执行ajax将项目添加到购物车有时它工作得很好,但有时购物车::add return true仍然没有将项目添加到购物车。有人知道为什么吗?
foreach (Cart::getContent() as $item) {
            if (($currentItem = Item::with('creator.country_info')->find($item->id))) {
                $itemVat = round($vat * $item->price / 100, 2);
                $subtotal += $item->price - $itemVat;
                $vatTotal += $itemVat;
                $items[] = [
                    'id' => $item->id,
                    'name' => $item->name,
                    'price' => $item->price,
                    'quantity' => $item->quantity,
                    'attributes' => $currentItem
                ];
            }
        }