protected function createFromModel($entity, $quantity)
    {
        $this->modelType = get_class($entity);
        $this->modelId = $entity->{$entity->getKeyName()};
        $this->setName($entity);
        $this->setPrice($entity);
        $this->setImage($entity);
        $this->quantity = $quantity;

        return $this;
    }
protected function createFromModel($entity, $quantity)
    {
        $this->modelType = get_class($entity);
        $this->modelId = $entity->{$entity->getKeyName()};
        $this->setName($entity);
        $this->setPrice($entity);
        $this->setImage($entity);
        $this->quantity = $quantity;

        return $this;
    }
protected function createFromModel ( $ entity , $ quantity ) { $ this -> modelType = get_class ( $ entity ) ; $ this -> modelId = $ entity -> { $ entity -> getKeyName ( ) } ; $ this -> setName ( $ entity ) ; $ this -> setPrice ( $ entity ) ; $ this -> setImage ( $ entity ) ; $ this -> quantity = $ quantity ; return $ this ; }
Creates a new cart item from a model instance.

@param Illuminate\Database\Eloquent\Model
@param int Quantity of the item
@return \Freshbitsweb\LaravelCartManager\Core\CartItem
Creates a new cart item from a model instance .