generateHash() public method

Generates a hash based on the cartItem array.
public generateHash ( boolean $force = false ) : string
$force boolean
return string itemHash
Exemplo n.º 1
0
 /**
  * Adds the cartItem into the cart session
  *
  * @param CartItem $cartItem
  *
  * @return CartItem
  */
 public function addItem(CartItem $cartItem)
 {
     $itemHash = $cartItem->generateHash();
     if ($this->getItem($itemHash)) {
         $this->getItem($itemHash)->qty += $cartItem->qty;
     } else {
         $this->cart->items[] = $cartItem;
     }
     \Event::fire('laracart.addItem', $cartItem);
     $this->update();
     return $cartItem;
 }