{"action":"closed","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/10478","labels_url":"https://api.github.com/repos/laravel/framework/issues/10478/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/10478/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/10478/events","html_url":"https://github.com/laravel/framework/issues/10478","id":109661001,"number":10478,"title":"Return collection from the query builder","user":{"login":"JosephSilber","id":1403741,"avatar_url":"https://avatars.githubusercontent.com/u/1403741?v=3","gravatar_id":"","url":"https://api.github.com/users/JosephSilber","html_url":"https://github.com/JosephSilber","followers_url":"https://api.github.com/users/JosephSilber/followers","following_url":"https://api.github.com/users/JosephSilber/following{/other_user}","gists_url":"https://api.github.com/users/JosephSilber/gists{/gist_id}","starred_url":"https://api.github.com/users/JosephSilber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JosephSilber/subscriptions","organizations_url":"https://api.github.com/users/JosephSilber/orgs","repos_url":"https://api.github.com/users/JosephSilber/repos","events_url":"https://api.github.com/users/JosephSilber/events{/privacy}","received_events_url":"https://api.github.com/users/JosephSilber/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":111,"created_at":"2015-10-04T03:34:30Z","updated_at":"2015-10-14T13:17:59Z","closed_at":"2015-10-14T13:17:59Z","body":"**This issue was created to get community feedback**.\r\n\r\n---\r\n\r\nIt would be awesome if we could have the query builder return a collection:\r\n\r\n```php\r\n$collection = DB::table('posts')->get();\r\n```\r\n\r\nGiven that PHP in some situations infamously does not treat `ArrayAccess` objects as arrays, this would be breaking BC. **This will obviously be targeted for the next release of Laravel**.\r\n\r\n## Pros\r\n\r\n1. Makes it consistent with Eloquent. You'll find countless questions on StackOverflow asking why some collection method can't be called on a query builder result.\r\n2. It's just much cleaner than this: `collect(DB::table('posts')->get())`. Laravel prides itself on making all these tiny interactions more enjoyable. This should not be any different.\r\n3. Native PHP arrays are just useless :smile: \r\n\r\n## Cons\r\n\r\n1. It's a breaking change. Some people's tests might fail because they're using `array_*` or typehinting for an array. If their code can't be updated to use a collection, they'll have to append `->all()` to their results.\r\n\r\nIf people don't have good test coverage, they'll have to search their codebase for `->get(` and manually tack on `->all()` wherever necessary. Not the end of the world, but definitely a breaking change.\r\n\r\n---\r\n\r\nOverall I think this change is well worth it and would love some feedback from the community. If you use the query builder directly, please leave a comment below with your thoughts either way, or if I missed any pros/cons.\r\n\r\nThank you :heart: "}}