src/Hassansin/DBCart/Models/Cart.php
public function addItem(array $attributes = []){
        if($item = $this->getItem(collect($attributes)->except(['quantity']))){
            $item->quantity += $attributes['quantity'];
            $item->save();
            return $item;
        }
        return $this->items()->create($attributes);
    }
public function addItem(array $attributes = []){
        if($item = $this->getItem(collect($attributes)->except(['quantity']))){
            $item->quantity += $attributes['quantity'];
            $item->save();
            return $item;
        }
        return $this->items()->create($attributes);
    }
public function addItem ( array $ attributes = [ ] ) { if ( $ item = $ this -> getItem ( collect ( $ attributes ) -> except ( [ 'quantity' ] ) ) ) { $ item -> quantity += $ attributes [ 'quantity' ] ; $ item -> save ( ) ; return $ item ; } return $ this -> items ( ) -> create ( $ attributes ) ; }
Add item to a cart. Increases quantity if the item already exists.

@param  array $attributes
Add item to a cart . Increases quantity if the item already exists .