{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/internals/issues/304","repository_url":"https://api.github.com/repos/laravel/internals","labels_url":"https://api.github.com/repos/laravel/internals/issues/304/labels{/name}","comments_url":"https://api.github.com/repos/laravel/internals/issues/304/comments","events_url":"https://api.github.com/repos/laravel/internals/issues/304/events","html_url":"https://github.com/laravel/internals/issues/304","id":189783449,"number":304,"title":"[5.4] Collection::random(int $amount) should always return a collection","user":{"login":"sebastiandedeyne","id":1561079,"avatar_url":"https://avatars.githubusercontent.com/u/1561079?v=3","gravatar_id":"","url":"https://api.github.com/users/sebastiandedeyne","html_url":"https://github.com/sebastiandedeyne","followers_url":"https://api.github.com/users/sebastiandedeyne/followers","following_url":"https://api.github.com/users/sebastiandedeyne/following{/other_user}","gists_url":"https://api.github.com/users/sebastiandedeyne/gists{/gist_id}","starred_url":"https://api.github.com/users/sebastiandedeyne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebastiandedeyne/subscriptions","organizations_url":"https://api.github.com/users/sebastiandedeyne/orgs","repos_url":"https://api.github.com/users/sebastiandedeyne/repos","events_url":"https://api.github.com/users/sebastiandedeyne/events{/privacy}","received_events_url":"https://api.github.com/users/sebastiandedeyne/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-11-16T17:34:25Z","updated_at":"2016-11-16T20:05:29Z","closed_at":null,"body":"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.\r\n\r\nExample use case: if you want to retrieve a random number of random items (useful in seeders), you can't predict the return value:\r\n\r\n```php\r\n$collection->random(rand(0, 5));\r\n// Should return a collection containing 0 to 5 items\r\n```\r\n\r\nProposed solution: change the default value to `null`, so `$collection->random()` still returns a single item.\r\n\r\nIf there's interest I'm willing to spin up a PR!"},"comment":{"url":"https://api.github.com/repos/laravel/internals/issues/comments/261056215","html_url":"https://github.com/laravel/internals/issues/304#issuecomment-261056215","issue_url":"https://api.github.com/repos/laravel/internals/issues/304","id":261056215,"user":{"login":"sebastiandedeyne","id":1561079,"avatar_url":"https://avatars.githubusercontent.com/u/1561079?v=3","gravatar_id":"","url":"https://api.github.com/users/sebastiandedeyne","html_url":"https://github.com/sebastiandedeyne","followers_url":"https://api.github.com/users/sebastiandedeyne/followers","following_url":"https://api.github.com/users/sebastiandedeyne/following{/other_user}","gists_url":"https://api.github.com/users/sebastiandedeyne/gists{/gist_id}","starred_url":"https://api.github.com/users/sebastiandedeyne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebastiandedeyne/subscriptions","organizations_url":"https://api.github.com/users/sebastiandedeyne/orgs","repos_url":"https://api.github.com/users/sebastiandedeyne/repos","events_url":"https://api.github.com/users/sebastiandedeyne/events{/privacy}","received_events_url":"https://api.github.com/users/sebastiandedeyne/received_events","type":"User","site_admin":false},"created_at":"2016-11-16T20:05:29Z","updated_at":"2016-11-16T20:05:29Z","body":"I know it breaks BC, but breaking changes are allowed between Laravel minor versions (it doesn't follow semver)"}}
{"actor":{"display_login":"sebastiandedeyne"}}