{"action":"opened","issue":{"url":"https://api.github.com/repos/rappasoft/laravel-5-boilerplate/issues/451","repository_url":"https://api.github.com/repos/rappasoft/laravel-5-boilerplate","labels_url":"https://api.github.com/repos/rappasoft/laravel-5-boilerplate/issues/451/labels{/name}","comments_url":"https://api.github.com/repos/rappasoft/laravel-5-boilerplate/issues/451/comments","events_url":"https://api.github.com/repos/rappasoft/laravel-5-boilerplate/issues/451/events","html_url":"https://github.com/rappasoft/laravel-5-boilerplate/issues/451","id":171166332,"number":451,"title":"Lazy loading on History renderType","user":{"login":"HilmanAnshori","id":3981733,"avatar_url":"https://avatars.githubusercontent.com/u/3981733?v=3","gravatar_id":"","url":"https://api.github.com/users/HilmanAnshori","html_url":"https://github.com/HilmanAnshori","followers_url":"https://api.github.com/users/HilmanAnshori/followers","following_url":"https://api.github.com/users/HilmanAnshori/following{/other_user}","gists_url":"https://api.github.com/users/HilmanAnshori/gists{/gist_id}","starred_url":"https://api.github.com/users/HilmanAnshori/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HilmanAnshori/subscriptions","organizations_url":"https://api.github.com/users/HilmanAnshori/orgs","repos_url":"https://api.github.com/users/HilmanAnshori/repos","events_url":"https://api.github.com/users/HilmanAnshori/events{/privacy}","received_events_url":"https://api.github.com/users/HilmanAnshori/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-15T13:07:17Z","updated_at":"2016-08-15T13:07:17Z","closed_at":null,"body":"Hello,\r\n\r\nThere's queries number problem on History repository when accessing renderType with string parameter.\r\nIn EloquentHistoryRepository line 63 : \r\n\r\n```php\r\n$history = History::whereHas('type', function ($query) use ($type) {\r\n   $query->where('name', ucfirst($type));\r\n})->latest()->get();\r\n```\r\nand this is queries count\r\n![screenshot_9](https://cloud.githubusercontent.com/assets/3981733/17665174/5acbd5ea-6323-11e6-808d-4161e7cd7b69.jpg)\r\n\r\nchanged it to : \r\n```php\r\n$history = History::with('user')->whereHas('type', function ($query) use ($type) {\r\n   $query->where('name', ucfirst($type));\r\n})->latest()->get();\r\n```\r\n\r\nresult : \r\n![screenshot_10](https://cloud.githubusercontent.com/assets/3981733/17665200/9813a02c-6323-11e6-8a08-9fc91d723698.jpg)\r\n\r\nThanks\r\n"}}
{"actor":{"display_login":"HilmanAnshori"}}