Retrieve the "count" result of the query.

@param  string  $columns
@return int
4211
public function count($columns = '*')
    {
        if (! is_array($columns)) {
            $columns = [$columns];
        }

        return (int) $this->aggregate(__FUNCTION__, $columns);
    }
1117962
public function getEntities($columns = ['*'])
    {
        // As we need the primary key to feed the
        // entity cache, we need it loaded on each
        // request
        if ($columns !== ['*']) {
            $columns = $this->enforceIdColumn($columns);
        }

        // Run the query
        $results = $this->query->get($columns);

        // Pass result set to the mapper and return the EntityCollection
        return $this->mapper->map($results, $this->getEagerLoads(), $this->useCache);
    }
135930
public function sum(string $column = null): int
    {
        if (!is_null($column)) {
            return $this->column($column)->sum();
        }

        return array_sum($this->toArray());
    }
1191906
public function get($columns = ['*'])
    {
        $columns = $this->query->getQuery()->columns ? [] : $columns;

        if ($columns === ['*']) {
            $columns = [$this->related->getTable().'.*'];
        }

        $columns[] = $this->getQualifiedFirstLocalKeyName().' as '.static::THROUGH_KEY;

        $this->query->addSelect($columns);

        return $this->query->get();
    }
860271
public function first($columns = ['*'])
    {
        $this->query->take(1);

        $results = $this->get($columns);

        if ($results instanceof Collection) {
            return $results->first();
        }

        return \count($results) > 0 ? \reset($results) : null;
    }
638360
public function count(string $column = '*', string $as = null)
    {
        $this->columns = [
            '' => [Query\Aggregation::count($column, $as)],
        ];

        return $this;
    }
509440
public function count(string $column = '*', string $alias = 'count'): ResultInterface
    {
        $this->aggregate['count'] = [$column, $alias];
        $this->addAggregateDecorator($alias);

        return $this->execute();
    }
830852
public function get($columns = ['*'])
    {
        $result = $this->getBuilder()->get($columns);

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

        return $result;
    }
1252156
public function columns($columns = [])
    {
        if (func_num_args() == 0) {
            return $this->columns;
        }

        if (func_num_args() == 1 && is_array($columns)) {
            foreach ($columns as $column => $label) {
                $this->column($column, $label);
            }

            return;
        }

        foreach (func_get_args() as $column) {
            $this->column($column);
        }
    }
598670
public function count($column = '*', bool $distinct = false)
    {
        parent::count($column, $distinct);
        return $this->getColumnResult();
    }
1116192
public function first($columns = ['*'])
    {
        $result = $this->take(1)->get($columns);
        return (isset($result[0])? $result[0] : null);
    }
322053
public function countAll($column = '*')
    {
        $results = $this->db->get($this->table, NULL, $column);

        return (int) count($results);
    }
511456
protected function _get($columns = '*')
    {
        $data = $this->db->select($this->table, $columns, $this->where);

        if (empty($data)) {
            return false;
        }

        return $this->getModelObjects($data);
    }
1090879
public function max(string $column): int
    {
        $max = $this->queryRelate->getQuery()->max($column);

        $this->resetQueryRelate();

        return $max;
    }
407028
public function columnCount()
    {

        switch ($this->mode) {

            case "mysql":
                $columns = $this->result->field_count;
                break;

            case "postgres":
            case "redshift":
                $columns = pg_num_fields($this->result);
                break;

            case "odbc":
                $columns = odbc_num_fields($this->result);
                break;

            case "sqlite":
                $columns = $this->result->numColumns();
                break;

            case "mssql":
                $columns = mssql_num_fields($this->result);
                break;

            case "mssqlsrv":
                $columns = sqlsrv_num_fields($this->result);
                break;
        }

        if ($columns === false || $columns < 0) {
            throw new \Exception("Failed to get the column count from the result set");
        }

        return $columns;
    }
1055581
public function select(string $column, string ...$columns)
    {
        $instance = $this->selectQueryInstance();

        $instance->selectQuery()->columns($column, ...$columns);

        return $instance;
    }
51482
public function get($columns = ['*'])
    {
        // First we'll add the proper select columns onto the query so it is run with
        // the proper columns. Then, we will get the results and hydrate out pivot
        // models with the result of those columns as a separate model relation.
        $columns = $this->query->getQuery()->columns ? [] : $columns;

        $builder = $this->query->applyScopes();

        $models = $builder->addSelect(
            $this->shouldSelect($columns)
        )->getModels();

        $this->hydratePivotRelation($models);

        // If we actually found models we will also eager load any relationships that
        // have been specified as needing to be eager loaded. This will solve the
        // n + 1 query problem for the developer and also increase performance.
        if (count($models) > 0) {
            $models = $builder->eagerLoadRelations($models);
        }

        return $this->related->newCollection($models);
    }