Recursively build up the query.

@param  string  $column
@param  string  $key
@param  string  $last
@param  callable  $callback
@return void
549159
protected function resolve($column, $key, $last, callable $callback)
    {
        if (! strpos($column, '.')) {
            return $callback("{$last}.{$column}", $key);
        }

        $scope = strstr($column, '.', true);
        $singular = str_singular($scope);
        $next = substr(strstr($column, '.'), 1);

        if (! in_array($scope, $this->loaded)) {
            $this->loaded[] = $scope;

            $this->builder->join($scope, "{$last}.{$singular}_id", "{$scope}.id");
        }

        return $this->resolve($next, $key, $scope, $callback);
    }
1117568
public function pluck($column, $key = null)
    {
        return parent::pluck(
            $this->getColumnName($column),
            $key
        );
    }
361760
protected function createColumn(string $key, array $columnConfiguration): void
    {
        $this->columns[] = new Column($key, $this, $columnConfiguration);
    }
1265544
public function chunk($count, $callback, $column = null, $order = 'asc')
    {
        $options = $this->getOptions();
        $column  = $column ?: $this->getPk($options);

        if (isset($options['order'])) {
            if ($this->config['debug']) {
                throw new DbException('chunk not support call order');
            }
            unset($options['order']);
        }

        $bind = $this->bind;

        if (is_array($column)) {
            $times = 1;
            $query = $this->options($options)->page($times, $count);
        } else {
            $query = $this->options($options)->limit($count);

            if (strpos($column, '.')) {
                list($alias, $key) = explode('.', $column);
            } else {
                $key = $column;
            }
        }

        $resultSet = $query->order($column, $order)->select();

        while (count($resultSet) > 0) {
            if ($resultSet instanceof Collection) {
                $resultSet = $resultSet->all();
            }

            if (false === call_user_func($callback, $resultSet)) {
                return false;
            }

            if (isset($times)) {
                $times++;
                $query = $this->options($options)->page($times, $count);
            } else {
                $end    = end($resultSet);
                $lastId = is_array($end) ? $end[$key] : $end->getData($key);

                $query = $this->options($options)
                    ->limit($count)
                    ->where($column, 'asc' == strtolower($order) ? '>' : '<', $lastId);
            }

            $resultSet = $query->bind($bind)->order($column, $order)->select();
        }

        return true;
    }
732810
public function addColumnLink($key, $name, $href = null, $column = null, array $params = null)
	{
		$this->addColumnCheck($key);
		$column = $column ?: $key;
		$href = $href ?: $key;

		if ($params === null) {
			$params = [$this->primary_key];
		}

		return $this->addColumn($key, new Column\ColumnLink($this, $key, $column, $name, $href, $params));
	}
1326628
public function select($column)
    {
        $builder         = new Select($this->driver);
        $this->lastQuery = $builder;

        $columns = is_array($column) ? $column : func_get_args();

        return $builder->select($columns);
    }
379748
public function addCallback(string $key, callable $callback): self
    {
        if (!isset($this->callbacks[$key])) {
            $this->callbacks[$key] = $callback;
        } else {
            throw new \Exception("Callback with key ($key) already exists");
        }

        return $this;
    }
17904
public function pluck($column, $key = null)
    {
        $result = $this->getBuilder()->pluck($column, $key);

        // Reset query builder
        $this->resetBuilder();

        return $result;
    }
519714
public function sear($key, Closure $callback)
    {
        if (is_array($key)) {
            return $this->searMany($key, $callback);
        }

        return parent::sear($key, $callback);
    }
254456
public function order(string $column, string $method = "DESC") : QueryBuilder
    {
        $this->_query[] = "ORDER BY";
        $this->_query[] = "`". $this->sanitize($column) ."`";
        $this->_query[] = (strtoupper($method) === "DESC") ? "DESC" : "ASC";

        return $this;
    }
872013
public function firePrimaryKeyCallbacks(int $primaryKey)
    {
        $this->columnData[$this->primaryKey] = $primaryKey;

        foreach ($this->onInsertCallbacks as $callback) {
            $callback($primaryKey);
        }
    }
1359541
protected function applyNullLastQuery($query, $column)
    {
        if ($this->databaseSupportsIf($query)) {
            $query = $query->orderBy(DB::raw("IF(`{$column}` IS NULL,1,0)"));
        }

        return $query;
    }
165750
public static function set_column(string $column): void
  {
		if ( bbn\str::check_name($column) ){
			self::$column = $column;
		}
	}
811435
public function chunk($count, $callback, $column = null, $order = 'asc')
    {
        $column    = $column ?: $this->getPk();
        $options   = $this->getOptions();
        $resultSet = $this->limit($count)->order($column, $order)->select();

        while (!empty($resultSet)) {
            if (false === call_user_func($callback, $resultSet)) {
                return false;
            }
            $end       = end($resultSet);
            $lastId    = is_array($end) ? $end[$column] : $end->$column;
            $resultSet = $this->options($options)
                ->limit($count)
                ->where($column, 'asc' == strtolower($order) ? '>' : '<', $lastId)
                ->order($column, $order)
                ->select();
        }
        return true;
    }
647048
function (query, callback) {
    if (!callback) {
      callback = query;
      query = null;
    }

    if (typeof query === 'string') {
      query = { aggregateId: query };
    }

    var self = this;

    this.store.getLastEvent(query, function (err, evt) {
      if (err) return callback(err);

      callback(null, new EventStream(self, query, evt ? [evt] : []));
    });
  }
767522
protected function withFreshQueryLog($callback)
    {
        $loggingQueries = $this->loggingQueries;

        // First we will back up the value of the logging queries property and then
        // we'll be ready to run callbacks. This query log will also get cleared
        // so we will have a new log of all the queries that are executed now.
        $this->enableQueryLog();

        $this->queryLog = [];

        // Now we'll execute this callback and capture the result. Once it has been
        // executed we will restore the value of query logging and give back the
        // value of the callback so the original callers can have the results.
        $result = $callback();

        $this->loggingQueries = $loggingQueries;

        return $result;
    }
1081889
public function pluck($column, $key = null)
    {
        $cacheKey = $this->generateKey([$column, $key]);

        return $this->cacheResults(get_called_class(), __FUNCTION__, $cacheKey, function () use ($column, $key) {
            return $this->model->pluck($column, $key);
        });
    }