public function generateHash($force = false)
    {
        if ($this->lineItem === false) {
            $this->itemHash = null;

            $cartItemArray = (array) $this;

            unset($cartItemArray['options']['qty']);

            ksort($cartItemArray['options']);

            $this->itemHash = app(LaraCart::HASH)->hash($cartItemArray);
        } elseif ($force || empty($this->itemHash) === true) {
            $this->itemHash = app(LaraCart::RANHASH);
        }

        app('events')->dispatch(
            'laracart.updateItem', [
                'item'    => $this,
                'newHash' => $this->itemHash,
            ]
        );

        return $this->itemHash;
    }
public function generateHash($force = false)
    {
        if ($this->lineItem === false) {
            $this->itemHash = null;

            $cartItemArray = (array) $this;

            unset($cartItemArray['options']['qty']);

            ksort($cartItemArray['options']);

            $this->itemHash = app(LaraCart::HASH)->hash($cartItemArray);
        } elseif ($force || empty($this->itemHash) === true) {
            $this->itemHash = app(LaraCart::RANHASH);
        }

        app('events')->dispatch(
            'laracart.updateItem', [
                'item'    => $this,
                'newHash' => $this->itemHash,
            ]
        );

        return $this->itemHash;
    }
public function generateHash ( $ force = false ) { if ( $ this -> lineItem === false ) { $ this -> itemHash = null ; $ cartItemArray = ( array ) $ this ; unset ( $ cartItemArray [ 'options' ] [ 'qty' ] ) ; ksort ( $ cartItemArray [ 'options' ] ) ; $ this -> itemHash = app ( LaraCart :: HASH ) -> hash ( $ cartItemArray ) ; } elseif ( $ force || empty ( $ this -> itemHash ) === true ) { $ this -> itemHash = app ( LaraCart :: RANHASH ) ; } app ( 'events' ) -> dispatch ( 'laracart.updateItem' , [ 'item' => $ this , 'newHash' => $ this -> itemHash , ] ) ; return $ this -> itemHash ; }
Generates a hash based on the cartItem array.

@param bool $force

@return string itemHash
Generates a hash based on the cartItem array .