Pagekit\Database\Query\QueryBuilder::limit PHP Метод

limit() публичный Метод

Sets the limit of the query.
public limit ( integer $limit ) : self
$limit integer
Результат self
    public function limit($limit)
    {
        $this->parts['limit'] = $limit;
        return $this;
    }

Usage Example

Пример #1
0
 /**
  * Execute the query and get the first result.
  *
  * @return mixed
  */
 public function first()
 {
     if ($entity = $this->manager->hydrateOne($this->query->limit(1)->execute(), $this->metadata)) {
         foreach ($this->getRelations() as $name => $query) {
             $this->manager->related($entity, $name, $query);
         }
         return $entity;
     }
     return null;
 }