Execute the query and get the first result.

@param  array   $columns
@return mixed|static
505489
public function first($columns = array('*'))
    {
        $results = $this->take(1)->get($columns)->current();

        return (isset($results[0]) && count($results[0]) > 0) ? $results[0]->getProperties() : null;
    }
428656
public function get($columns = ['*'])
    {
        $builder = $this->applyScopes();

        // If we actually found models we will also eager load any relationships that
        // have been specified as needing to be eager loaded, which will solve the
        // n+1 query issue for the developers to avoid running a lot of queries.
        if (count($models = $builder->getModels($columns)) > 0) {
            $models = $builder->eagerLoadRelations($models);
        }

        return $models;
    }
193127
public static function getTree(array $columns = ['*'])
    {
        /**
         * @var Entity $instance
         */
        $instance = new static;

        return $instance->orderBy($instance->getParentIdColumn())->orderBy($instance->getPositionColumn())
            ->get($instance->prepareTreeQueryColumns($columns))->toTree();
    }
178702
public function first($columns = array('*'))
    {
        $columns = is_array($columns) ? $columns : func_get_args();

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

        return current($results);
    }
384316
public function get($columns = array('*'))
    {
        $results = parent::get($columns);

        switch($this->returnType) {
            case Builder::RETURN_TYPE_DATAMAPPER:
                return $results->toDatamapperObject();
            case Builder::RETURN_TYPE_ELOQUENT:
                return $results;
        }
    }
648974
public function findIndex(array $columns): ?AbstractIndex
    {
        foreach ($this->indexes as $index) {
            if ($index->getColumns() == $columns) {
                return $index;
            }
        }

        return null;
    }
1349818
public function get(array $columns = ['*']): ResultInterface
    {
        if (empty($columns)) {
            $columns = ['*'];
        }

        $isAllColumns = count($columns) == 1 && isset($columns[0]) && $columns[0] == '*';
        if (!empty($this->className) && $isAllColumns) {
            $columns = $this->getAllFields();
        }

        foreach ($columns as $column => $alias) {
            if (\is_int($column)) {
                $this->select[$alias] = null;
                continue;
            }
            $this->select[$column] = $alias;
        }

        $this->addGetDecorator();

        return $this->execute();
    }
1229390
public function columns($columns = array())
    {
        foreach ((array) $columns as $key => $value)
        {
            if (is_string($key)) {
                $this->columns[$key] = $value;
            } else {
                $this->columns[] = $value;
            }
        }

        return $this;
    }
714455
public function getLastChild(array $columns = ['*'])
    {
        if ($this->hasChildrenRelation()) {
            $result = $this->getRelation($this->getChildrenRelationIndex())->last();
        } else {
            $result = $this->children(static::QUERY_LAST)->first($columns);
        }

        return $result;
    }
1078533
public function update($columns)
    {
        $update = array();
        foreach ($columns as $k => $v) {
            $update[] = "`$k` = :$k";
            $this->params[":$k"] = $v;
        }
        $update = implode(", ", $update);
        $q = "UPDATE {$this->table} as `t` {$this->join} SET $update WHERE {$this->condition}";
        if ($this->limit) {
            $q .= " LIMIT {$this->limit}";
        }
        return $this->connection->execQuery($q, $this->params);
    }
467409
public function get( $columns = [ '*' ] ) {
		return $this->onceWithColumns( $columns, function () {
			return $this->connection->fetchAll( $this->toSql(), $this->getBindings() );
		} );
	}
973364
public function get($columns = array('*'))
	{
		if (!$this->applyMetaFilters()) {
			if (!empty($this->aggregate)) {
				return 0;
			}
			return $this->model->newCollection();
		}
		
		if (!empty($this->aggregate)) {
			return parent::get($columns);
		}
		else {
			$results = parent::get(array('m.xref_id'));
		}
		
		if (empty($results)) {
			return $this->model->newCollection();
		}
		
		$xref_ids = array();
		foreach ($results as $result) {
			if (!isset($result->xref_id)) continue;
			$xref_ids[] = $result->xref_id;
		}
		
		if (empty($xref_ids)) {
			return $this->model->newCollection();
		}
		
		$key = $this->model->getKeyName();
		
		$models = $this->model->newQuery()->whereIn($key, $xref_ids)->get();
		
		$models->sortBy(function ($model) use ($xref_ids, $key) {
			foreach ($xref_ids as $idx => $i) {
				if ($model->{$key} == $i) {
					return $idx;
				}
			}
			return 0;
		});
		
		if (!empty($this->relations)) {
			$models->load($this->relations);
		}
		
		return $models;
	}
741519
protected function _first($columns = '*')
    {
        $data = $this->db->get($this->table, $columns, $this->where);

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

        return $this->setProperties($data);
    }
1116192
public function first($columns = ['*'])
    {
        $result = $this->take(1)->get($columns);
        return (isset($result[0])? $result[0] : null);
    }
1086732
public function getChildren(array $columns = ['*'])
    {
        if ($this->hasChildrenRelation()) {
            $result = $this->getRelation($this->getChildrenRelationIndex());
        } else {
            $result = $this->children()->get($columns);
        }

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

        if (is_null($original)) {
            $this->columns = $columns;
        }

        // encrypted columns replace their default (original) columns
        if ($this->encryptionModel instanceof Model
            && method_exists($this->encryptionModel, 'getEncryptKey')
        ) {
            $model = $this->encryptionModel;
            $modelEncryptionColumns = $model::getEncryptedFields();
            if (!empty($modelEncryptionColumns)) {
                if ($columns == ['*']) {
                    $this->columns = [];

                    /*
                     * Select all visible columns (avoid select *)
                     */
                    $visibles = array_diff(array_merge($model->getFillable(), $model->getGuarded()), $model->getHidden());
                    $unencryptedVisibles = array_unique(array_diff($visibles, array_column($this->encryptionColumns, 'column')));
                    sort($unencryptedVisibles);

                    $primaryKey = [
                        $model->getKeyName()
                    ];

                    $attributes = array_merge($primaryKey, $unencryptedVisibles);

                    if ($model->usesTimestamps()) {
                        $attributes[] = $model->getCreatedAtColumn();
                        $attributes[] = $model->getUpdatedAtColumn();
                    }

                    // add all visible unencrypted columns
                    foreach ($attributes as $attribute) {
                        $this->columns[] = $attribute;
                    }

                    // add all encrypted columns
                    $this->columns = array_merge($this->columns, array_column($this->encryptionColumns, 'select'));
                } else {
                    $this->columns = [];

                    // add all visible unencrypted columns
                    $encryptionColumnNames = array_column($this->encryptionColumns, 'column');
                    foreach ($columns as $column) {
                        if (!in_array($column, $encryptionColumnNames)) {
                            $this->columns[] = $column;
                        }
                    }
                    // add the encrypted columns (and decrypted, if 'withDecryptionKey' was given)
                    foreach ($this->encryptionColumns as $encryptionColumn){
                        if (in_array($encryptionColumn['column'], $columns)) {
                            $this->columns[] = $encryptionColumn['select'];
                        }
                    }
                }
            }
        }

        $results = $this->processor->processSelect($this, $this->runSelect());

        $this->columns = $original;

        return collect($results);
    }
1260837
public function fetchData($columns = null)
    {

        // auto populate columns with arrays from the existing Table
        // when user does not supply a parameter to this function
        if($columns == null)
        {
            $this->_selectedColumns = $this->getTableColumns();
        }
        else
        {
            if(is_array($columns))
            {
                $this->_selectedColumns = $columns;
            }
            else
            {
                throw new \InvalidArgumentException('Invalid argument provided on Column parameter');
            }
        }

        $select = new Select();

        $select->columns(array_keys($this->_selectedColumns));
        $select->from($this->tableGateway->getTable());
        $resultSet = $this->tableGateway->selectWith($select);
        $resultSet->buffer();
        $this->_selectedValues = $resultSet;

        return $resultSet;

    }