protected function cartItemsCheck($entity)
    {
        return function ($item) use ($entity) {
            return $item->modelType == get_class($entity) &&
                $item->modelId == $entity->{$entity->getKeyName()}
            ;
        };
    }
protected function cartItemsCheck($entity)
    {
        return function ($item) use ($entity) {
            return $item->modelType == get_class($entity) &&
                $item->modelId == $entity->{$entity->getKeyName()}
            ;
        };
    }
protected function cartItemsCheck ( $ entity ) { return function ( $ item ) use ( $ entity ) { return $ item -> modelType == get_class ( $ entity ) && $ item -> modelId == $ entity -> { $ entity -> getKeyName ( ) } ; } ; }
Checks if a cart item with the specified entity already exists.

@param Illuminate\Database\Eloquent\Model
@return \Closure
Checks if a cart item with the specified entity already exists .