Zero value to return with no limit in take func

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();
}
}
Merge pull request #1053 from miguelbgouveia/patch-1

Zero value to return with no limit in take func