Skip to content

Commit

Permalink
Lavarel 7
Browse files Browse the repository at this point in the history
  • Loading branch information
olimortimer committed Mar 24, 2020
1 parent f1732a0 commit bcd52a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
}
],
"require": {
"illuminate/support": "5.*.* || 6.0.*",
"illuminate/session": "5.*.* || 6.0.*",
"illuminate/events": "5.*.* || 6.0.*"
"illuminate/support": "5.*.* || 6.*.* || 7.*.*",
"illuminate/session": "5.*.* || 6.*.* || 7.*.*",
"illuminate/events": "5.*.* || 6.*.* || 7.*.*"
},
"require-dev": {
"phpunit/phpunit": "~5.0 || ~6.0 || ~7.0 || ~8.0",
Expand Down
14 changes: 8 additions & 6 deletions src/CartItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
use Gloudemans\Shoppingcart\Contracts\Buyable;
use Illuminate\Contracts\Support\Jsonable;

use Illuminate\Support\Arr;

class CartItem implements Arrayable, Jsonable
{
/**
Expand Down Expand Up @@ -206,12 +208,12 @@ public function updateFromBuyable(Buyable $item)
*/
public function updateFromArray(array $attributes)
{
$this->id = array_get($attributes, 'id', $this->id);
$this->qty = array_get($attributes, 'qty', $this->qty);
$this->name = array_get($attributes, 'name', $this->name);
$this->price = array_get($attributes, 'price', $this->price);
$this->id = Arr::get($attributes, 'id', $this->id);
$this->qty = Arr::get($attributes, 'qty', $this->qty);
$this->name = Arr::get($attributes, 'name', $this->name);
$this->price = Arr::get($attributes, 'price', $this->price);
$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());
}
Expand Down Expand Up @@ -301,7 +303,7 @@ public static function fromBuyable(Buyable $item, array $options = [])
*/
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'], $options);
}
Expand Down

0 comments on commit bcd52a0

Please sign in to comment.