You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 16, 2021. It is now read-only.
Currently, if you call $collection->random(1), you'll get a single item back. This makes sense if there isn't a parameter set, but if 1 is explicitly passed through, it should return a new collection instance. This keeps it consistent with passing in any other integer.
Example use case: if you want to retrieve a random number of random items (useful in seeders), you can't predict the return value:
$collection->random(rand(0, 5));
// Should return a collection containing 0 to 5 items
Proposed solution: change the default value to null, so $collection->random() still returns a single item.