计算购物车商品总额
This commit is contained in:
parent
cc6f47a99d
commit
55423be548
|
|
@ -18,8 +18,7 @@ class SubtotalService
|
|||
{
|
||||
public static function getTotal(TotalService $totalService)
|
||||
{
|
||||
$carts = $totalService->cartProducts;
|
||||
$amount = collect($carts)->sum('subtotal');
|
||||
$amount = self::getAmount($totalService);
|
||||
$totalData = [
|
||||
'code' => 'sub_total',
|
||||
'title' => trans('shop/carts.product_total'),
|
||||
|
|
@ -32,4 +31,10 @@ class SubtotalService
|
|||
|
||||
return $totalData;
|
||||
}
|
||||
|
||||
public static function getAmount(TotalService $totalService)
|
||||
{
|
||||
$carts = $totalService->cartProducts;
|
||||
return collect($carts)->sum('subtotal');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue