Remove the scope from the given Eloquent query builder.

@param  \Illuminate\Database\Eloquent\Builder  $builder
@return void
500758
public function remove(Builder $builder, Model $model) {
    $column = $model->getQualifiedSingleTableTypeColumn();

    $query = $builder->getQuery();

    $bindings = $query->getRawBindings()['where'];
    foreach ((array) $query->wheres as $key => $where) {
      // If the where clause is a single table inheritance in constraint, we will remove it from
      // the query and reset the keys on the wheres. This allows this developer to
      // include model in a relationship result set that is lazy loaded.

      if ($this->isSingleTableInheritanceConstraint($where, $column)) {
        unset($query->wheres[$key]);

        // Assume (naively) that no other scope is binding the same values as the values of our in query.
        // Not perfect but its about the best we can do without they query keeping better track of which bindings
        // belong to which where clause.
        foreach($where['values'] as $value) {
          if (($binding_key = array_search($value, $bindings)) >= 0) {
            unset($bindings[$binding_key]);
          }
        }

        $query->setBindings(array_values($bindings));
        $query->wheres = array_values($query->wheres);
      }
    }
  }
449224
protected function addWithoutEnded(Builder $builder): void
    {
        $builder->macro('withoutEnded', function (Builder $builder) {
            return $builder->withoutGlobalScope($this)->whereNull('ended_at');
        });
    }
274086
protected function addWithNotPublished(Builder $builder): void
    {
        $builder->macro('withNotPublished', function (Builder $builder) {
            return $builder->withoutGlobalScope($this);
        });
    }
1120169
public function apply(Builder $builder, Model $model): void
    {
        if (method_exists($model, 'shouldApplyEndedAtScope') && $model->shouldApplyEndedAtScope()) {
            $builder->whereNull('ended_at');
        }
    }
101300
protected function addOnlyClosed(Builder $builder): void
    {
        $builder->macro('onlyClosed', function (Builder $builder) {
            return $builder->withoutGlobalScope($this)->where('is_closed', 1);
        });
    }
510866
public function scopeWithoutTenants(Builder $builder, $tenants): Builder
    {
        $tenants = $this->prepareTenantIds($tenants);

        return $builder->whereDoesntHave('tenants', function (Builder $builder) use ($tenants) {
            $builder->whereIn('id', $tenants);
        });
    }
312969
public function scopeOfOwner(Builder $builder, Model $owner): Builder
    {
        return $builder->where('owner_type', $owner->getMorphClass())->where('owner_id', $owner->getKey());
    }
231538
protected function addOnlyExpired(Builder $builder): void
    {
        $builder->macro('onlyExpired', function (Builder $builder) {
            return $builder->withoutGlobalScope($this)->whereNotNull('expired_at');
        });
    }
1289328
protected function addWithNotVerified(Builder $builder): void
    {
        $builder->macro('withNotVerified', function (Builder $builder) {
            return $builder->withoutGlobalScope($this);
        });
    }
66708
public function apply(QueryBuilder $builder)
    {
        $builder->where($this->name, $this->operation, $this->value);
    }
1243896
protected function addOnlyBanned(Builder $builder): void
    {
        $builder->macro('onlyBanned', function (Builder $builder) {
            return $builder->withoutGlobalScope($this)->whereNotNull('banned_at');
        });
    }
746595
public function apply(Builder $builder, Model $model): void
    {
        $builder->orderBy(self::NAME_ATTRIBUTE);
    }
853251
public function scopeWithheld(Builder $query)
    {
        return $query->where(function ($query)
        {
            $query->where('status', '<=', Node::DRAFT)
                ->orWhere(function ($query)
                {
                    $query->where('status', '<=', Node::PENDING)
                        ->where('published_at', '>', Carbon::now());
                });
        });
    }
326995
protected function addWithoutNotAccepted(Builder $builder): void
    {
        $builder->macro('withoutNotAccepted', function (Builder $builder) {
            return $builder->withoutGlobalScope($this)->whereNotNull('accepted_at');
        });
    }
772469
protected function addWithDrafted(Builder $builder): void
    {
        $builder->macro('withDrafted', function (Builder $builder) {
            return $builder->withoutGlobalScope($this);
        });
    }
831834
protected function addWithEnded(Builder $builder): void
    {
        $builder->macro('withEnded', function (Builder $builder) {
            return $builder->withoutGlobalScope($this);
        });
    }
713978
protected function addWithoutNotVerified(Builder $builder): void
    {
        $builder->macro('withoutNotVerified', function (Builder $builder) {
            return $builder->withoutGlobalScope($this)->where('is_verified', 1);
        });
    }