Illuminate\Database\Query\Builder::take PHP Method

take() public method

Alias to set the "limit" value of the query.
public take ( integer $value ) : Builder | static
$value integer
return Builder | static
    public function take($value)
    {
        return $this->limit($value);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Execute the query and get the first result.
  *
  * @param  array   $columns
  *
  * @return mixed|static
  */
 public function first($columns = ['*'])
 {
     $this->query->take(1);
     $results = $this->get($columns);
     if ($results instanceof Collection) {
         return $results->first();
     }
     return count($results) > 0 ? reset($results) : null;
 }
All Usage Examples Of Illuminate\Database\Query\Builder::take