本文整理匯總了PHP中Illuminate\Database\Query\Builder::first方法的典型用法代碼示例。如果您正苦於以下問題:PHP Builder::first方法的具體用法?PHP Builder::first怎麽用?PHP Builder::first使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Database\Query\Builder
的用法示例。
在下文中一共展示了Builder::first方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: first
/**
* 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);
}
示例2: first
/**
* Return the first entry.
*
* @param array $columns
* @return EloquentModel|EntryInterface
*/
public function first(array $columns = ['*'])
{
return (new Decorator())->decorate($this->query->first($columns));
}
示例3: getEntity
/**
* 주어진 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));
}
示例4: first
/**
* 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);
}