Skip to content

Commit

Permalink
Merge pull request #15 from JackieDo/v2.0
Browse files Browse the repository at this point in the history
Update Cart.php
  • Loading branch information
JackieDo authored Apr 14, 2020
2 parents ef0c285 + b849bdf commit b233f58
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ public function add($id, $title = null, $qty = 1, $price = 0, array $options = [
$cartItem = $this->updateQty($cartItem->hash, $cartContent->get($cartItem->hash)->qty + $cartItem->qty);
} else {
// If item is not exists in the cart, we will put new item to the cart
$this->event->fire('cart.adding', [$cartItem, $cartContent]);
$this->fireEvent('cart.adding', [$cartItem, $cartContent]);

$cartContent->put($cartItem->hash, $cartItem);
$this->updateCartSession($cartContent);

$this->event->fire('cart.added', [$cartItem, $cartContent]);
$this->fireEvent('cart.added', [$cartItem, $cartContent]);
}

return $cartItem;
Expand Down Expand Up @@ -151,12 +151,12 @@ public function remove($itemHash)
if ($cartContent->has($itemHash)) {
$cartItem = $this->get($itemHash);

$this->event->fire('cart.removing', [$cartItem, $cartContent]);
$this->fireEvent('cart.removing', [$cartItem, $cartContent]);

$cartContent->forget($itemHash);
$this->updateCartSession($cartContent);

$this->event->fire('cart.removed', [$cartItem, $cartContent]);
$this->fireEvent('cart.removed', [$cartItem, $cartContent]);
}

return $this;
Expand Down Expand Up @@ -223,11 +223,11 @@ public function destroy()
{
$cartContent = $this->getContent();

$this->event->fire('cart.destroying', $cartContent);
$this->fireEvent('cart.destroying', $cartContent);

$this->session->remove($this->instance);

$this->event->fire('cart.destroyed', $cartContent);
$this->fireEvent('cart.destroyed', $cartContent);

return $this;
}
Expand Down Expand Up @@ -403,7 +403,7 @@ protected function updateCartItem($itemHash, $attributes)

$cartItem = $cartContent->get($itemHash);

$this->event->fire('cart.updating', [$cartItem, $cartContent]);
$this->fireEvent('cart.updating', [$cartItem, $cartContent]);

$cartContent->pull($itemHash);
$cartItem->update($attributes);
Expand All @@ -416,7 +416,7 @@ protected function updateCartItem($itemHash, $attributes)
$cartContent->put($cartItem->hash, $cartItem);
$this->updateCartSession($cartContent);

$this->event->fire('cart.updated', [$cartItem, $cartContent]);
$this->fireEvent('cart.updated', [$cartItem, $cartContent]);

return $cartItem;
}
Expand Down

0 comments on commit b233f58

Please sign in to comment.