In Laravel Eloquent what is the difference between limit vs take?

With the Query Builder, take() is just an alias for limit():

/**
 * Alias to set the "limit" value of the query.
 *
 * @param  int  $value
 * @return \Illuminate\Database\Query\Builder|static
 */
public function take($value)
{
    return $this->limit($value);
}

NB This is not to be confused with take() on Collections.


limit only works for eloquent ORM or query builder objects, whereas take works for both collections and the ORM or Query Builder objects.

Model::get()->take(20);   // Correct
Model::get()->limit(20);  // Incorrect

Model::take(20)->get()    // Correct
Model::limit(20)->get()   // Correct