反选其他

This commit is contained in:
Edward Yang 2022-08-26 14:13:00 +08:00
parent 54bfb88e12
commit 054359af34
1 changed files with 4 additions and 0 deletions

View File

@ -92,6 +92,7 @@ class CartController extends Controller
{
$skuId = $request->sku_id;
$quantity = $request->quantity ?? 1;
$buyNow = (bool)$request->buy_now ?? false;
$customer = current_customer();
$sku = ProductSku::query()
@ -99,6 +100,9 @@ class CartController extends Controller
->findOrFail($skuId);
$cart = CartService::add($sku, $quantity, $customer);
if ($buyNow) {
CartService::select($customer, [$cart->id]);
}
return json_success(trans('shop/carts.added_to_cart'), $cart);
}
}