/** * get first row * * @param array $columns get columns list * @return mixed|static */ public function first(array $columns = ['*']) { if ($this->dynamic === false) { return $this->query->first($columns); } if ($this->proxy === true) { $this->query = $this->getProxyManager()->first($this->query); } return $this->query->first($columns); }
/** * Return the first entry. * * @param array $columns * @return EloquentModel|EntryInterface */ public function first(array $columns = ['*']) { return (new Decorator())->decorate($this->query->first($columns)); }
/** * 주어진 query를 실행한 후 query결과를 entity로 생성하여 반환한다. * * @param Builder $query 질의 * @param string[]|null $with entity와 함께 반환할 relation 정보 * * @return null|Entity */ protected function getEntity($query, $with = null) { $attributes = $query->first(); if ($attributes === null) { return null; } $collection = [$attributes]; $collection = $this->loadRelations($collection, $with); return $this->newEntity(array_shift($collection)); }
/** * get first row * * @param array $columns get columns list * @return mixed|static */ public function first($columns = ['*']) { if ($this->dynamic === false) { return parent::first($columns); } if ($this->proxy === true) { $this->getProxyManager()->first($this); } return parent::first($columns); }