Skip to content

Commit bcd52a0

Browse files
committed
Lavarel 7
1 parent f1732a0 commit bcd52a0

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
}
1919
],
2020
"require": {
21-
"illuminate/support": "5.*.* || 6.0.*",
22-
"illuminate/session": "5.*.* || 6.0.*",
23-
"illuminate/events": "5.*.* || 6.0.*"
21+
"illuminate/support": "5.*.* || 6.*.* || 7.*.*",
22+
"illuminate/session": "5.*.* || 6.*.* || 7.*.*",
23+
"illuminate/events": "5.*.* || 6.*.* || 7.*.*"
2424
},
2525
"require-dev": {
2626
"phpunit/phpunit": "~5.0 || ~6.0 || ~7.0 || ~8.0",

src/CartItem.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
use Gloudemans\Shoppingcart\Contracts\Buyable;
77
use Illuminate\Contracts\Support\Jsonable;
88

9+
use Illuminate\Support\Arr;
10+
911
class CartItem implements Arrayable, Jsonable
1012
{
1113
/**
@@ -206,12 +208,12 @@ public function updateFromBuyable(Buyable $item)
206208
*/
207209
public function updateFromArray(array $attributes)
208210
{
209-
$this->id = array_get($attributes, 'id', $this->id);
210-
$this->qty = array_get($attributes, 'qty', $this->qty);
211-
$this->name = array_get($attributes, 'name', $this->name);
212-
$this->price = array_get($attributes, 'price', $this->price);
211+
$this->id = Arr::get($attributes, 'id', $this->id);
212+
$this->qty = Arr::get($attributes, 'qty', $this->qty);
213+
$this->name = Arr::get($attributes, 'name', $this->name);
214+
$this->price = Arr::get($attributes, 'price', $this->price);
213215
$this->priceTax = $this->price + $this->tax;
214-
$this->options = new CartItemOptions(array_get($attributes, 'options', $this->options));
216+
$this->options = new CartItemOptions(Arr::get($attributes, 'options', $this->options));
215217

216218
$this->rowId = $this->generateRowId($this->id, $this->options->all());
217219
}
@@ -301,7 +303,7 @@ public static function fromBuyable(Buyable $item, array $options = [])
301303
*/
302304
public static function fromArray(array $attributes)
303305
{
304-
$options = array_get($attributes, 'options', []);
306+
$options = Arr::get($attributes, 'options', []);
305307

306308
return new self($attributes['id'], $attributes['name'], $attributes['price'], $options);
307309
}

0 commit comments

Comments
 (0)