Add a "WHERE" clause to the given query.

@param  \Nova\Database\Query\Builder  $query
@param  string  $key
@param  string  $extraValue
@return void
774019
protected function addWhere(QueryBuilder $query, $key, $extraValue)
    {
        if ($extraValue === 'NULL') {
            $query->whereNull($key);
        } elseif ($extraValue === 'NOT_NULL') {
            $query->whereNotNull($key);
        } else {
            $query->where($key, $extraValue);
        }
    }
937487
private static function addEntityQueryCondition(QueryInterface &$query, $key, $value) {
    $simple = array(
      'from' => ['timestamp', '>='],
      'to' => ['timestamp', '<'],
    );

    if (isset($simple[$key])) {
      list($field, $op) = $simple[$key];
      $query->condition($field, $value, $op);
      return;
    }

    $query->condition($key, $value);
  }
781880
public function addToQuery(&$query)
    {
        parent::addToQuery($query);

        foreach ($this->compositeDatabaseFields() as $field => $spec) {
            $table = $this->getTable();
            $key = $this->getName() . $field;
            if ($table) {
                $query->selectField("\"{$table}\".\"{$key}\"");
            } else {
                $query->selectField("\"{$key}\"");
            }
        }
    }
804876
protected function mappedSelectListsKey(Builder $query, $key)
    {
        if ($this->hasColumn($key)) {
            return $query->addSelect($this->getTable() . '.' . $key);
        }

        return $query->addSelect($key);
    }
1291133
protected function applySearchClauses(Builder $query): void
    {
        if ($searched = $this->getAttribute('request')->search) {
            $this->getAttribute('searchableColumns')
                ->map(function (TableListColumn $column, int $key) use (&$query, $searched) {
                    $table = $column->getAttribute('customColumnTable');
                    $attribute = $column->getAttribute('customColumnTableRealAttribute')
                        ? $column->getAttribute('customColumnTableRealAttribute')
                        : $column->getAttribute('attribute');
                    if ($key > 0) {
                        $query->orWhere($table . '.' . $attribute, 'like', '%' . $searched . '%');
                    } else {
                        $query->where($table . '.' . $attribute, 'like', '%' . $searched . '%');
                    }
                });
        }
    }
1131274
public function getMultiCount($collection, $column, array $values, array $extra = [])
    {
        $builder = $this->select($collection);
        $builder->where($builder->expr()->in("e.{$column}", $values));

        $this->queryExtraConditions($extra, $builder);

        return $builder->getQuery()->getSingleScalarResult();
    }
821130
public function addQueryParameter($key, $value, $override = true)
    {
        if (!isset($this->queryParameters[$key]) || true === $override) {
            $this->queryParameters[$key] = $value;
            return true;
        }

        return false;
    }
53053
protected function whereBasic(Builder $query, $where)
    {
        if (Str::contains(strtolower($where['operator']), 'like')) {
            return sprintf(
                '%s::text %s %s',
                $this->wrap($where['column']),
                $where['operator'],
                $this->parameter($where['value'])
            );
        }

        return parent::whereBasic($query, $where);
    }
1087519
public function getUser(string $query, array $extra_args = null)
    {
        if (is_numeric($query)) {
            $response = $this->getUserByID($query, $extra_args);
            if (!isset($response['errors'])) {
                return $response;
            }
        }
        return $this->getUserByUsername($query, $extra_args);
    }
991135
protected function configureQuery(SelectQuery $query, bool $loadColumns = true, array $outerKeys = []): SelectQuery
    {
        if ($loadColumns) {
            if ($this->isJoined()) {
                //Mounting columns
                $this->mountColumns($query, $this->options['minify']);
            } else {
                //This is initial set of columns (remove all existed)
                $this->mountColumns($query, $this->options['minify'], '', true);
            }
        }

        return parent::configureQuery($query);
    }
90652
private static function createWarningFromInvalidValue(array $extra, $key, $default, $additionalMessage = '')
    {
        $warning = sprintf(
            'Invalid value "%s" for option "%s", defaulting to "%s".',
            $extra[$key],
            $key,
            $default
        );

        if ($additionalMessage) {
            $warning .= ' ' . $additionalMessage;
        }

        return $warning;
    }
758630
protected function addWhere(&$conditions, $key, $extraValue) {
        if ($extraValue === 'NULL') {
            $conditions[$key] = null;
        } elseif ($extraValue === 'NOT_NULL') {
            $conditions[$key . '!='] = null;
        } else {
            $conditions[$key] = $extraValue;
        }
    }
661162
protected function whereDate(Builder $query, $where)
    {
        $value = $this->parameter($where['value']);

        return 'cast('.$this->wrap($where['column']).' as date) '.$where['operator'].' '.$value;
    }
901890
public function visit($query, $node, string $context)
    {
        if ($node instanceof $this->node) {
            $bindings = [];
            $sql = [];

            $child0 = $node->getChildByIndex(0);

            if ($child0 instanceof Nodes\KeyNode) {
                $context === Nodes\OrNode::class && $query->orWhereNull($this->parseKey($child0->getValue()));
                $context === Nodes\AndNode::class && $query->whereNull($this->parseKey($child0->getValue()));
            }
        }
    }
1077908
protected function setKey(Field & $field, $key, $extra)
    {
        $key = strtoupper($key);

        if ($key == 'PRIMARY KEY') {
            $field->isPrimary = true;
        }

        if ($key == 'MUL') {
            $field->isIndex = true;
        }

        if ($key == 'UNI') {
            $field->isUnique = true;
        }

        if (strtolower($extra) == 'auto_increment') {
            $field->isAutoIncrement = true;
        }

        return $this;
    }
172298
public function visit($query, $node, string $context)
    {
        if ($node instanceof $this->node) {
            $child0 = $node->getChildByIndex(0);
            $child1 = $node->getChildByIndex(1);

            if ($context === Nodes\OrNode::class) {
                $query->orWhere($this->parseNode($query, $child0), $this->operator, $this->parseNode($query, $child1));
            }

            if ($context === Nodes\AndNode::class) {
                $query->where($this->parseNode($query, $child0), $this->operator, $this->parseNode($query, $child1));
            }
        }
    }
432742
public EventBuilder withExtra(String extraName, Object extraValue) {
        event.getExtra().put(extraName, extraValue);
        return this;
    }