mirror of
https://github.com/kevin-DL/LaravelShoppingcart.git
synced 2026-01-24 07:55:35 +00:00
Update CartItem.php
This commit is contained in:
@@ -226,8 +226,9 @@ class CartItem implements Arrayable, Jsonable
|
|||||||
/**
|
/**
|
||||||
* Create a new instance from a Buyable.
|
* Create a new instance from a Buyable.
|
||||||
*/
|
*/
|
||||||
public static function fromBuyable(Buyable $item, int $qty = 1, CartItemOptions $options = new CartItemOptions([])) : self
|
public static function fromBuyable(Buyable $item, int $qty = 1, ?CartItemOptions $options = null) : self
|
||||||
{
|
{
|
||||||
|
$options = $options ?: new CartItemOptions([])
|
||||||
return new self($item->getBuyableIdentifier($options), $item->getBuyableDescription($options), $item->getBuyablePrice($options), $qty, $item->getBuyableWeight($options), $options);
|
return new self($item->getBuyableIdentifier($options), $item->getBuyableDescription($options), $item->getBuyablePrice($options), $qty, $item->getBuyableWeight($options), $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user