mirror of
https://github.com/kevin-DL/LaravelShoppingcart.git
synced 2026-01-23 07:31:31 +00:00
@@ -7,7 +7,7 @@
|
|||||||
[](https://packagist.org/packages/bumbummen99/shoppingcart)
|
[](https://packagist.org/packages/bumbummen99/shoppingcart)
|
||||||
[](https://packagist.org/packages/bumbummen99/shoppingcart)
|
[](https://packagist.org/packages/bumbummen99/shoppingcart)
|
||||||
|
|
||||||
This is a fork of [Crisane's LaravelShoppingcart](https://github.com/Crinsane/LaravelShoppingcart) extended with minor features compatible with Laravel 5.8.
|
This is a fork of [Crisane's LaravelShoppingcart](https://github.com/Crinsane/LaravelShoppingcart) extended with minor features compatible with Laravel 6.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"illuminate/support": "5.4.*||5.5.*||5.6.*||5.7.*||5.8.*",
|
"illuminate/support": "5.4.*||5.5.*||5.6.*||5.7.*||5.8.*||6.0.*",
|
||||||
"illuminate/session": "5.4.*||5.5.*||5.6.*||5.7.*||5.8.*",
|
"illuminate/session": "5.4.*||5.5.*||5.6.*||5.7.*||5.8.*||6.0.*",
|
||||||
"illuminate/events": "5.4.*||5.5.*||5.6.*||5.7.*||5.8.*"
|
"illuminate/events": "5.4.*||5.5.*||5.6.*||5.7.*||5.8.*||6.0.*"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "~5.0||~6.0||~7.0||~8.0",
|
"phpunit/phpunit": "~5.0||~6.0||~7.0||~8.0",
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace Gloudemans\Shoppingcart;
|
|||||||
use Gloudemans\Shoppingcart\Contracts\Buyable;
|
use Gloudemans\Shoppingcart\Contracts\Buyable;
|
||||||
use Illuminate\Contracts\Support\Arrayable;
|
use Illuminate\Contracts\Support\Arrayable;
|
||||||
use Illuminate\Contracts\Support\Jsonable;
|
use Illuminate\Contracts\Support\Jsonable;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
class CartItem implements Arrayable, Jsonable
|
class CartItem implements Arrayable, Jsonable
|
||||||
{
|
{
|
||||||
@@ -289,13 +290,13 @@ class CartItem implements Arrayable, Jsonable
|
|||||||
*/
|
*/
|
||||||
public function updateFromArray(array $attributes)
|
public function updateFromArray(array $attributes)
|
||||||
{
|
{
|
||||||
$this->id = array_get($attributes, 'id', $this->id);
|
$this->id = Arr::get($attributes, 'id', $this->id);
|
||||||
$this->qty = array_get($attributes, 'qty', $this->qty);
|
$this->qty = Arr::get($attributes, 'qty', $this->qty);
|
||||||
$this->name = array_get($attributes, 'name', $this->name);
|
$this->name = Arr::get($attributes, 'name', $this->name);
|
||||||
$this->price = array_get($attributes, 'price', $this->price);
|
$this->price = Arr::get($attributes, 'price', $this->price);
|
||||||
$this->weight = array_get($attributes, 'weight', $this->weight);
|
$this->weight = Arr::get($attributes, 'weight', $this->weight);
|
||||||
$this->priceTax = $this->price + $this->tax;
|
$this->priceTax = $this->price + $this->tax;
|
||||||
$this->options = new CartItemOptions(array_get($attributes, 'options', $this->options));
|
$this->options = new CartItemOptions(Arr::get($attributes, 'options', $this->options));
|
||||||
|
|
||||||
$this->rowId = $this->generateRowId($this->id, $this->options->all());
|
$this->rowId = $this->generateRowId($this->id, $this->options->all());
|
||||||
}
|
}
|
||||||
@@ -412,7 +413,7 @@ class CartItem implements Arrayable, Jsonable
|
|||||||
*/
|
*/
|
||||||
public static function fromArray(array $attributes)
|
public static function fromArray(array $attributes)
|
||||||
{
|
{
|
||||||
$options = array_get($attributes, 'options', []);
|
$options = Arr::get($attributes, 'options', []);
|
||||||
|
|
||||||
return new self($attributes['id'], $attributes['name'], $attributes['price'], $attributes['weight'], $options);
|
return new self($attributes['id'], $attributes['name'], $attributes['price'], $attributes['weight'], $options);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user