illuminate/database — pull request #124 by miguelbgouveia (2013-04-23 13:08:43+00:00)
Title: Change the Builder->take() funtion to consider zero value as return with no limit 

In many situations, when using Eloquent objects, we create a function to retrieve a Collection of objects based on a specific filter. Example:

public function getUsersByName ($name, $limit = 0)
{
return User::where('name', 'like', '%'.$name'%')->take($limit)->get();
}

In this kind of functions we want to limit the collection when some limit is specified and retrieve all objects when no limit is specified. To accomplish this we change the take function in order to consider the value 0 as to retrieve all the founded objects. Without this change we have always to implement the previous function like this:

public function getUsersByName ($name, $limit = 0)
{
if ($limit = 0) {
return User::where('name', 'like', '%'.$name'%')->get();
}
else {
return User::where('name', 'like', '%'.$name'%')->take($limit)->get();
}
}