mirror of
https://github.com/kevin-DL/LaravelShoppingcart.git
synced 2026-01-23 23:51:25 +00:00
Update CartItem.php
This commit is contained in:
@@ -10,6 +10,8 @@ use Illuminate\Contracts\Support\Arrayable;
|
|||||||
use Illuminate\Contracts\Support\Jsonable;
|
use Illuminate\Contracts\Support\Jsonable;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
use Money\Money;
|
use Money\Money;
|
||||||
|
use Money\Formatter\DecimalMoneyFormatter;
|
||||||
|
use Money\Currencies\ISOCurrencies;
|
||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -283,6 +285,14 @@ class CartItem implements Arrayable, Jsonable
|
|||||||
return json_encode($this->toArray(), $options);
|
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.
|
* Generate a unique id for the cart item.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user