Return the first result.

@param array $columns Columns to get.

@return mixed
511308
public static function first($columns = [])
    {
        $model = static::getInstance();
        $item  = $model->getAll($columns, 1);

        return $item->first();
    }
63581
public function uSortMultipleColumn($columns)
    {
        $dataFormats = $this->dataFormats;
        $sort = function ($a, $b) use ($columns, $dataFormats) {
            foreach ($columns as $colName => $fn) {
                $tmp = $fn($a[$colName], $b[$colName]);
                if ($tmp !== 0) {
                    return $tmp;
                }
            }
            return 0;
        };

        uasort($this->data, $sort);
        return $this;
    }
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;
    }
984297
public function firstOrFail($columns = ['*'])
    {
        if (! is_null($model = $this->first($columns))) {
            return $model;
        }
        throw new RuntimeException("No query results for model [".get_class($this->model)."]");
    }
1353032
public function firstOrFail($columns = ['*'])
    {
        if (!is_null($entity = $this->first($columns))) {
            return $entity;
        }

        throw (new EntityNotFoundException())->setEntity(get_class($this->entityMap));
    }
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);
    }
179596
public function get($columns = ['*'])
    {
        $cacheKey = $this->generateCacheKey();

        if (null === ($results = $this->cache->tags($this->cacheTag)->get($cacheKey))) {
            $results = parent::get($columns);

            if ($this->isTimeAwareQuery) {
                // Cache results for $cacheLifeTime minutes
                $this->cache->tags($this->cacheTag)->put($cacheKey, $results, $this->cacheLifeTime);
            } else {
                // Cache results forever
                $this->cache->tags($this->cacheTag)->forever($cacheKey, $results);
            }
        }


        return $results;
    }
456640
public function groupBy($array, $columns)
    {
        // ensure $columns parameter is array
        $columns = (array) $columns;

        // get first group-by column
        $col = array_shift($columns);

        $result = array();
        foreach ($array as $row) {
            $key = (string) is_object($row) ? $row->$col : $row[$col];
            if (!isset($result[$key])) {
                $result[$key] = array();
            }

            $result[$key][] = $row;
        }

        // do subsequent group by calls
        if (count($columns)) {
            foreach (array_keys($result) as $key) {
                $result[$key] = $this->groupBy($result[$key], $columns);
            }
        }

        return $result;
    }
274906
public function value( $column )
	{
		$result = $this->first( [$column] );

		return $result ? $result->{$column} : null;
	}
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();
    }
945439
public function get($columns = ['*'])
    {
        if ( ! is_null($this->cacheSeconds)) {
            return $this->getCached($columns);
        }

        return parent::get($columns);
    }
414791
protected function select($columns=[])
    {
        $query = $this->model->newQuery()->getQuery();
        if ($columns) {
            $query->select($columns);
        }
        return $query;
    }
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;
    }
684891
public function get($columns = ['*'])
    {
        $builder = $this->prepareQueryBuilder($columns);

        $models = $builder->getModels();

        // 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);
    }
411830
public function find($slug, array $columns = ['*'])
    {
        $model = $this->model;

        return $model::where('slug', '=', $slug)->first($columns);
    }
1312716
protected function getSelectColumns(array $columns = ['*'])
    {
        if ($columns == ['*']) {
            $columns = [$this->relatedMap->getTable().'.*'];
        }

        return array_merge($columns, [$this->parentMap->getTable().'.'.$this->firstKey]);
    }