|
6 | 6 | use Gloudemans\Shoppingcart\Contracts\Buyable; |
7 | 7 | use Illuminate\Contracts\Support\Jsonable; |
8 | 8 |
|
| 9 | +use Illuminate\Support\Arr; |
| 10 | + |
9 | 11 | class CartItem implements Arrayable, Jsonable |
10 | 12 | { |
11 | 13 | /** |
@@ -206,12 +208,12 @@ public function updateFromBuyable(Buyable $item) |
206 | 208 | */ |
207 | 209 | public function updateFromArray(array $attributes) |
208 | 210 | { |
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); |
213 | 215 | $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)); |
215 | 217 |
|
216 | 218 | $this->rowId = $this->generateRowId($this->id, $this->options->all()); |
217 | 219 | } |
@@ -301,7 +303,7 @@ public static function fromBuyable(Buyable $item, array $options = []) |
301 | 303 | */ |
302 | 304 | public static function fromArray(array $attributes) |
303 | 305 | { |
304 | | - $options = array_get($attributes, 'options', []); |
| 306 | + $options = Arr::get($attributes, 'options', []); |
305 | 307 |
|
306 | 308 | return new self($attributes['id'], $attributes['name'], $attributes['price'], $options); |
307 | 309 | } |
|
0 commit comments