{"action":"created","issue":{"url":"https://api.github.com/repos/spatie/laravel-query-builder/issues/95","repository_url":"https://api.github.com/repos/spatie/laravel-query-builder","labels_url":"https://api.github.com/repos/spatie/laravel-query-builder/issues/95/labels{/name}","comments_url":"https://api.github.com/repos/spatie/laravel-query-builder/issues/95/comments","events_url":"https://api.github.com/repos/spatie/laravel-query-builder/issues/95/events","html_url":"https://github.com/spatie/laravel-query-builder/issues/95","id":353421663,"node_id":"MDU6SXNzdWUzNTM0MjE2NjM=","number":95,"title":"Expose a public \"isAppended($field)\" method on QueryBuilder.","user":{"login":"adaojunior","id":4921294,"node_id":"MDQ6VXNlcjQ5MjEyOTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/4921294?v=4","gravatar_id":"","url":"https://api.github.com/users/adaojunior","html_url":"https://github.com/adaojunior","followers_url":"https://api.github.com/users/adaojunior/followers","following_url":"https://api.github.com/users/adaojunior/following{/other_user}","gists_url":"https://api.github.com/users/adaojunior/gists{/gist_id}","starred_url":"https://api.github.com/users/adaojunior/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adaojunior/subscriptions","organizations_url":"https://api.github.com/users/adaojunior/orgs","repos_url":"https://api.github.com/users/adaojunior/repos","events_url":"https://api.github.com/users/adaojunior/events{/privacy}","received_events_url":"https://api.github.com/users/adaojunior/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-23T14:58:10Z","updated_at":"2018-10-29T16:47:13Z","closed_at":null,"author_association":"NONE","body":"I believe it would be a good solution for cases such as counting a relationship:\r\n\r\n```\r\n$builder = QueryBuilder::for(Customer::class);\r\n\r\nif($builder->isAppended('orders_count')) {\r\n    $builder->withCount('orders_count');\r\n}\r\n```\r\n\r\nYou may also consider adding `whenAppended($field)`:\r\n\r\n```\r\n$builder->whenAppended('orders_count', function($builder){\r\n    $builder->withCount('orders_count');\r\n})\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/spatie/laravel-query-builder/issues/comments/433986425","html_url":"https://github.com/spatie/laravel-query-builder/issues/95#issuecomment-433986425","issue_url":"https://api.github.com/repos/spatie/laravel-query-builder/issues/95","id":433986425,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMzk4NjQyNQ==","user":{"login":"AlexVanderbist","id":6287961,"node_id":"MDQ6VXNlcjYyODc5NjE=","avatar_url":"https://avatars2.githubusercontent.com/u/6287961?v=4","gravatar_id":"","url":"https://api.github.com/users/AlexVanderbist","html_url":"https://github.com/AlexVanderbist","followers_url":"https://api.github.com/users/AlexVanderbist/followers","following_url":"https://api.github.com/users/AlexVanderbist/following{/other_user}","gists_url":"https://api.github.com/users/AlexVanderbist/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexVanderbist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexVanderbist/subscriptions","organizations_url":"https://api.github.com/users/AlexVanderbist/orgs","repos_url":"https://api.github.com/users/AlexVanderbist/repos","events_url":"https://api.github.com/users/AlexVanderbist/events{/privacy}","received_events_url":"https://api.github.com/users/AlexVanderbist/received_events","type":"User","site_admin":false},"created_at":"2018-10-29T16:47:13Z","updated_at":"2018-10-29T16:47:13Z","author_association":"MEMBER","body":"That `whenAppended` method looks like a pretty neat solution! Feel free to send a PR including tests for this 👍 "}}
{"actor":{"display_login":"AlexVanderbist"}}