send($coupon) ->through($this->checkers) ->then(function ($coupon) use (&$cartWithCoupon) { Cart::applyCoupon($coupon); $cartWithCoupon = json_encode(Cart::instance()); Cart::removeCoupon(); }); return $cartWithCoupon; } /** * Destroy resources by given ids. * * @return \Modules\Cart\Cart */ public function destroy(): \Modules\Cart\Cart { Cart::removeCoupon(); return Cart::instance(); } }