Add a WITH clause to the query.

@param  array  $parts
@return \Vinelab\NeoEloquent\Query\Builder|static
514800
public function with(array $parts)
    {
        foreach ($parts as $key => $part)
        {
            $this->with[$key] = $part;
        }

        return $this;
    }
957431
public function addClause(Clause $clause)
    {
        $classname = array_pop(explode('\\', get_class($clause)));
        $this->clauses[$classname] = $clause;

        return $this;
    }
1106428
protected function getWhere(array $queryParts)
    {
        if (!isset($queryParts['where']) || empty($queryParts['where'])) {
            return null;
        }

        $where = array();
        foreach ($queryParts['where'] as $w) {
            $where[] = $this->formatWhere($w);
        }

        return 'WHERE ' . implode(' AND ', $where);
    }
59484
public function addPart($part): CompositeBuilder
    {
        if (!empty($part) || ($part instanceof self && $part->count() > 0)) {
            $this->parts[] = $part;
        }
        return $this;
    }
542603
public function withCount($relations)
    {
        if (empty($relations)) {
            return $this;
        }
        if (is_null($this->query->columns)) {
            $this->query->select([$this->query->from.'.*']);
        }
        $relations = is_array($relations) ? $relations : func_get_args();
        foreach ($this->parseWithRelations($relations) as $name => $constraints) {
            // First we will determine if the name has been aliased using an "as" clause on the name
            // and if it has we will extract the actual relationship name and the desired name of
            // the resulting column. This allows multiple counts on the same relationship name.
            $segments = explode(' ', $name);
            unset($alias);
            if (count($segments) == 3 && mb_strtolower($segments[1]) == 'as') {
                list($name, $alias) = [$segments[0], $segments[2]];
            }
            $relation = $this->getRelationWithoutConstraints($name);
            // Here we will get the relationship count query and prepare to add it to the main query
            // as a sub-select. First, we'll get the "has" query and use that to get the relation
            // count query. We will normalize the relation name then append _count as the name.
            $query = $relation->getRelationExistenceCountQuery(
                $relation->getRelated()->newQuery(), $this
            );
            $query->callScope($constraints);
            $query->mergeConstraintsFrom($relation->getQuery());
            // Finally we will add the proper result column alias to the query and run the subselect
            // statement against the query builder. Then we will return the builder instance back
            // to the developer for further constraint chaining that needs to take place on it.
            $column = str_snake(isset($alias) ? $alias : $name).'_count';
            $this->selectSub($query->toBase(), $column);
        }
        return $this;
    }
1200032
public function addNestedWhereQuery($query)
    {
        if (count($query->wheres)) {
            $wheres = $this->wheres ?: [];

            $this->wheres = array_merge($wheres, $query->wheres);
        }

        return $this;
    }
515998
private function collect(string ...$pieces): self
    {
        foreach ($pieces as $piece) {
            $parts = $this->getPartsFromSegment($piece);
            foreach ($parts as $part) {
                $this->add($part);
            }
        }

        return $this;
    }
1100811
private function _or($queries)
    {
        $this->where['$or'] = array();
        $length = count($queries);
        for ($i = 0; $i < $length; $i++)
        {
            $this->where['$or'][] = $queries[$i]->where;
        }

        return $this;
    }
1290358
public function join(Clause\Join $clause)
    {
        if (is_array($clause)) {
            $this->join = array_merge($this->join[], array_values($clause));
        } else {
            $this->join[] = $clause;
        }

        return $this;
    }
369381
public function append($parts)
    {
        if ($parts instanceof Message) {
            $parts = $parts->toArray();
        } elseif (!is_array($parts)) {
            throw new \Exception('Trying to append non array ('.gettype($parts).').');
        }
        $this->parts = array_merge($this->parts, $parts);

        return $this;
    }
1374831
public function whereIn(string $key, array $values): QueryBuilder
    {
        $this->addWhere($key, 'IN', $values, 'AND');
        return $this;
    }
738161
public function with($with)
    {
        if (! is_array($with)) {
            $with = func_get_args();
        }

        $this->with = $with;

        return $this;
    }
185132
public function addQueries($queries) {
        if(is_array($queries)) {
            foreach($queries as $query) {
                $this->addQuery($query);
            }

            new Logger('Queries added to the queue.', Logger::DEBUG, __CLASS__, __LINE__);
            return $this;
        }

        new Logger('Failed to add to the queue.', Logger::ERROR, __CLASS__, __LINE__);
        return $this;
    }
1065337
public function orWhereIn(string $key, array $values): QueryBuilder
    {
        $this->addWhere($key, 'IN', $values, 'OR');
        return $this;
    }
8766
public function setQueries($queries)
    {
        $this->queries = [];
        if (!is_array($queries)) {
            $queries = [$queries];
        }
        foreach ($queries as $query) {
            $this->addQuery($query);
        }

        return $this;
    }
1054697
protected function setUriParts(array $parts)
    {
        foreach ($parts as $key => $value) {
            if (!method_exists($this, "set$key")) {
                continue;
            }
            $this->{"set$key"}($value);
        }
    }
83000
public static function createFromParse(array $parts)
    {
        $uri = new static();
        if (isset($parts['schema'])) {
            $uri->scheme = UriFilter::scheme($parts['schema']);
        }
        if (isset($parts['host'])) {
            $uri->host = UriFilter::host($parts['host']);
        }
        if (isset($parts['port'])) {
            $uri->port = UriFilter::port($parts['port']);
        }
        if (isset($parts['path'])) {
            $uri->path = UriFilter::path($parts['path']);
        }
        if (isset($parts['query'])) {
            $uri->query = UriFilter::body($parts['query']);
        }
        if (isset($parts['fragment'])) {
            $uri->fragment = UriFilter::body($parts['fragment']);
        }
        if (isset($parts['user'])) {
            $uri->userInfo = $parts['user'];
        }
        if (isset($parts['pass'])) {
            $uri->userInfo .= ':' . $parts['pass'];
        }
        $uri->validate();
        return $uri;
    }