public function removeAt($cartItemIndex)
    {
        $this->existenceCheckFor($cartItemIndex);

        $item = $this->items[$cartItemIndex];

        $this->cartDriver->removeCartItem($item->id);
        $this->items = $this->items->forget($cartItemIndex)->values(); // To reset the index

        $modelType = $item->modelType;
        $entity = $modelType::find($item->modelId);
        event(new CartItemRemoved($entity));

        return $this->cartUpdates();
    }
public function removeAt($cartItemIndex)
    {
        $this->existenceCheckFor($cartItemIndex);

        $item = $this->items[$cartItemIndex];

        $this->cartDriver->removeCartItem($item->id);
        $this->items = $this->items->forget($cartItemIndex)->values(); // To reset the index

        $modelType = $item->modelType;
        $entity = $modelType::find($item->modelId);
        event(new CartItemRemoved($entity));

        return $this->cartUpdates();
    }
public function removeAt ( $ cartItemIndex ) { $ this -> existenceCheckFor ( $ cartItemIndex ) ; $ item = $ this -> items [ $ cartItemIndex ] ; $ this -> cartDriver -> removeCartItem ( $ item -> id ) ; $ this -> items = $ this -> items -> forget ( $ cartItemIndex ) -> values ( ) ; // To reset the index $ modelType = $ item -> modelType ; $ entity = $ modelType :: find ( $ item -> modelId ) ; event ( new CartItemRemoved ( $ entity ) ) ; return $ this -> cartUpdates ( ) ; }
Removes an item from the cart.

@param int index of the item
@return array
Removes an item from the cart .