From 230fd57c924a45726e4d46bf773a5ce2e96f73a7 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sat, 5 Feb 2022 21:24:19 +0100 Subject: [PATCH] Update CartItem.php --- src/CartItem.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/CartItem.php b/src/CartItem.php index cd7b9bc..bd68d3f 100644 --- a/src/CartItem.php +++ b/src/CartItem.php @@ -10,6 +10,8 @@ use Illuminate\Contracts\Support\Arrayable; use Illuminate\Contracts\Support\Jsonable; use Illuminate\Support\Arr; use Money\Money; +use Money\Formatter\DecimalMoneyFormatter; +use Money\Currencies\ISOCurrencies; use ReflectionClass; /** @@ -283,6 +285,14 @@ class CartItem implements Arrayable, Jsonable return json_encode($this->toArray(), $options); } + /** + * Generate a unique id for the cart item. + */ + private function formatMoney(Money $money) : string + { + return (new DecimalMoneyFormatter(new ISOCurrencies()))->format($money); + } + /** * Generate a unique id for the cart item. */