From 1190d72b5279bbd9016a72dbfbc0cd3e3f945699 Mon Sep 17 00:00:00 2001 From: Patrick Henninger Date: Fri, 28 Dec 2018 03:50:42 +0100 Subject: [PATCH] Add changes from https://github.com/Crinsane/LaravelShoppingcart/pull/350 Add changes from https://github.com/Crinsane/LaravelShoppingcart/pull/349 Add changes from https://github.com/Crinsane/LaravelShoppingcart/pull/478 --- README.md | 10 +++++----- config/cart.php | 4 ++-- src/Cart.php | 8 ++++---- src/CartItem.php | 2 +- tests/CartTest.php | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 9e82741..b4a4e6c 100644 --- a/README.md +++ b/README.md @@ -174,7 +174,7 @@ Cart::total(); The method will automatically format the result, which you can tweak using the three optional parameters ```php -Cart::total($decimals, $decimalSeperator, $thousandSeperator); +Cart::total($decimals, $decimalSeparator, $thousandSeparator); ``` You can set the default number format in the config file. @@ -192,7 +192,7 @@ Cart::tax(); The method will automatically format the result, which you can tweak using the three optional parameters ```php -Cart::tax($decimals, $decimalSeperator, $thousandSeperator); +Cart::tax($decimals, $decimalSeparator, $thousandSeparator); ``` You can set the default number format in the config file. @@ -210,7 +210,7 @@ Cart::subtotal(); The method will automatically format the result, which you can tweak using the three optional parameters ```php -Cart::subtotal($decimals, $decimalSeperator, $thousandSeperator); +Cart::subtotal($decimals, $decimalSeparator, $thousandSeparator); ``` You can set the default number format in the config file. @@ -228,7 +228,7 @@ Cart::discount(); The method will automatically format the result, which you can tweak using the three optional parameters ```php -Cart::discount($decimals, $decimalSeperator, $thousandSeperator); +Cart::discount($decimals, $decimalSeparator, $thousandSeparator); ``` You can set the default number format in the config file. @@ -246,7 +246,7 @@ Cart::initial(); The method will automatically format the result, which you can tweak using the three optional parameters ```php -Cart::initial($decimals, $decimalSeperator, $thousandSeperator); +Cart::initial($decimals, $decimalSeparator, $thousandSeparator); ``` You can set the default number format in the config file. diff --git a/config/cart.php b/config/cart.php index 45f93f4..1885a0a 100644 --- a/config/cart.php +++ b/config/cart.php @@ -49,7 +49,7 @@ return [ | Default number format |-------------------------------------------------------------------------- | - | This defaults will be used for the formated numbers if you don't + | This defaults will be used for the formatted numbers if you don't | set them in the method call. | */ @@ -60,7 +60,7 @@ return [ 'decimal_point' => '.', - 'thousand_seperator' => ',' + 'thousand_separator' => ',' ], diff --git a/src/Cart.php b/src/Cart.php index ce15705..9688ce4 100644 --- a/src/Cart.php +++ b/src/Cart.php @@ -575,11 +575,11 @@ class Cart $stored = $this->getConnection()->table($this->getTableName()) ->where('identifier', $identifier)->first(); - $storedContent = unserialize($stored->content); + $storedContent = unserialize(data_get($stored, 'content')); $currentInstance = $this->currentInstance(); - $this->instance($stored->instance); + $this->instance(data_get($stored, 'instance')); $content = $this->getContent(); @@ -742,7 +742,7 @@ class Cart } /** - * Get the Formated number + * Get the Formatted number * * @param $value * @param $decimals @@ -759,7 +759,7 @@ class Cart $decimalPoint = is_null(config('cart.format.decimal_point')) ? '.' : config('cart.format.decimal_point'); } if(is_null($thousandSeperator)){ - $thousandSeperator = is_null(config('cart.format.thousand_seperator')) ? ',' : config('cart.format.thousand_seperator'); + $thousandSeperator = is_null(config('cart.format.thousand_separator')) ? ',' : config('cart.format.thousand_separator'); } return number_format($value, $decimals, $decimalPoint, $thousandSeperator); diff --git a/src/CartItem.php b/src/CartItem.php index df3b403..4f10cb5 100644 --- a/src/CartItem.php +++ b/src/CartItem.php @@ -456,7 +456,7 @@ class CartItem implements Arrayable, Jsonable } if (is_null($thousandSeperator)){ - $thousandSeperator = is_null(config('cart.format.thousand_seperator')) ? ',' : config('cart.format.thousand_seperator'); + $thousandSeperator = is_null(config('cart.format.thousand_separator')) ? ',' : config('cart.format.thousand_separator'); } return number_format($value, $decimals, $decimalPoint, $thousandSeperator); diff --git a/tests/CartTest.php b/tests/CartTest.php index eb2e24b..fbb93f2 100644 --- a/tests/CartTest.php +++ b/tests/CartTest.php @@ -1034,6 +1034,6 @@ class CartTest extends TestCase { $this->app['config']->set('cart.format.decimals', $decimals); $this->app['config']->set('cart.format.decimal_point', $decimalPoint); - $this->app['config']->set('cart.format.thousand_seperator', $thousandSeperator); + $this->app['config']->set('cart.format.thousand_separator', $thousandSeperator); } }