Skip to content

Commit f078eff

Browse files
authored
Merge pull request #6 from Weble/feature/parameters-not-null
pass discounts as a parameter
2 parents 96c251d + 55337eb commit f078eff

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/Cart/CartItem.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ class CartItem extends DataTransferObject implements Arrayable, Jsonable
2323
public Collection $attributes;
2424
public DiscountCollection $discounts;
2525

26-
public function __construct(array $parameters = [])
27-
{
28-
$this->attributes = collect([]);
29-
$this->discounts = DiscountCollection::make([]);
30-
31-
parent::__construct($parameters);
32-
}
33-
3426
public function withDiscount(Discount $discount): self
3527
{
3628
if ($discount->target !== DiscountTarget::Item) {
@@ -65,6 +57,7 @@ public static function fromPurchasable(Purchasable $purchasable, float $quantity
6557
'attributes' => $attributes,
6658
'quantity' => $quantity,
6759
'price' => $purchasable->cartPrice($attributes),
60+
'discounts' => DiscountCollection::make([]),
6861
]);
6962
}
7063

0 commit comments

Comments
 (0)