Skip to content

Commit

Permalink
return cart itemclear
Browse files Browse the repository at this point in the history
  • Loading branch information
lukepolo committed Jan 27, 2018
1 parent 824f857 commit 73b0702
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/CartItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,19 @@ public function getDiscount($format = true)
);
}

/**
* @param CouponContract $coupon
* @return $this
*/
public function addCoupon(CouponContract $coupon)
{
$coupon->appliedToCart = false;
app('laracart')->addCoupon($coupon);
$this->code = $coupon->code;
$this->couponInfo = $coupon->options;
$this->discount = $coupon->discount($this);

return $this;
}

/**
Expand Down Expand Up @@ -376,12 +382,18 @@ public function searchForSubItem($data)
return $matches;
}

/**
*
*/
public function disable()
{
$this->active = false;
app('laracart')->update();
}

/**
*
*/
public function enable()
{
$this->active = true;
Expand Down

0 comments on commit 73b0702

Please sign in to comment.