{"action":"created","comment":{"url":"https://api.github.com/repos/AT-PHPIntership/book-library/pulls/comments/170165601","pull_request_review_id":98811106,"id":170165601,"diff_hunk":"@@ -18,6 +18,35 @@\n \n class BookController extends Controller\n {\n+    /**\n+     * Get top 10 most review\n+     *\n+     * @return \\Illuminate\\Http\\Response\n+     */\n+    public function getTopReview()\n+    {\n+        $fields = [\n+            'name',\n+            'books.image',\n+            'avg_rating',\n+        ];\n+        $reviewBooks = Book::select($fields)->withCount(['posts' => function ($query) {\n+            $query->where('type', 1);\n+        }])->orderBy('posts_count', 'DESC')\n+           ->limit(10)\n+           ->get();\n+        foreach ($reviewBooks as $book) {\n+            $book['image'] = request()->getHttpHost(). '/' . $book['image'];\n+        }\n+        return response()->json([\n+            'meta' => [\n+                'status' => 'successfully',","path":"app/Http/Controllers/Api/BookController.php","position":26,"original_position":26,"commit_id":"9da6bc857ade9700494c9f8e833317adc91f660d","original_commit_id":"9da6bc857ade9700494c9f8e833317adc91f660d","user":{"login":"at-nhuibo","id":10772428,"avatar_url":"https://avatars3.githubusercontent.com/u/10772428?v=4","gravatar_id":"","url":"https://api.github.com/users/at-nhuibo","html_url":"https://github.com/at-nhuibo","followers_url":"https://api.github.com/users/at-nhuibo/followers","following_url":"https://api.github.com/users/at-nhuibo/following{/other_user}","gists_url":"https://api.github.com/users/at-nhuibo/gists{/gist_id}","starred_url":"https://api.github.com/users/at-nhuibo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-nhuibo/subscriptions","organizations_url":"https://api.github.com/users/at-nhuibo/orgs","repos_url":"https://api.github.com/users/at-nhuibo/repos","events_url":"https://api.github.com/users/at-nhuibo/events{/privacy}","received_events_url":"https://api.github.com/users/at-nhuibo/received_events","type":"User","site_admin":false},"body":"`'successfully'` phải define trong config rồi gọi ra nhé, chứ ko hard code thế này.","created_at":"2018-02-23T04:41:04Z","updated_at":"2018-02-23T04:41:29Z","html_url":"https://github.com/AT-PHPIntership/book-library/pull/191#discussion_r170165601","pull_request_url":"https://api.github.com/repos/AT-PHPIntership/book-library/pulls/191","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/AT-PHPIntership/book-library/pulls/comments/170165601"},"html":{"href":"https://github.com/AT-PHPIntership/book-library/pull/191#discussion_r170165601"},"pull_request":{"href":"https://api.github.com/repos/AT-PHPIntership/book-library/pulls/191"}}},"pull_request":{"url":"https://api.github.com/repos/AT-PHPIntership/book-library/pulls/191","id":170671673,"html_url":"https://github.com/AT-PHPIntership/book-library/pull/191","diff_url":"https://github.com/AT-PHPIntership/book-library/pull/191.diff","patch_url":"https://github.com/AT-PHPIntership/book-library/pull/191.patch","issue_url":"https://api.github.com/repos/AT-PHPIntership/book-library/issues/191","number":191,"state":"open","locked":false,"title":"Top 10 book review api","user":{"login":"at-anhngo","id":33854557,"avatar_url":"https://avatars0.githubusercontent.com/u/33854557?v=4","gravatar_id":"","url":"https://api.github.com/users/at-anhngo","html_url":"https://github.com/at-anhngo","followers_url":"https://api.github.com/users/at-anhngo/followers","following_url":"https://api.github.com/users/at-anhngo/following{/other_user}","gists_url":"https://api.github.com/users/at-anhngo/gists{/gist_id}","starred_url":"https://api.github.com/users/at-anhngo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-anhngo/subscriptions","organizations_url":"https://api.github.com/users/at-anhngo/orgs","repos_url":"https://api.github.com/users/at-anhngo/repos","events_url":"https://api.github.com/users/at-anhngo/events{/privacy}","received_events_url":"https://api.github.com/users/at-anhngo/received_events","type":"User","site_admin":false},"body":"## Description\r\nApi return top 10 book review \r\n## Reference Requirements\r\n- Product Backlog ID: #PBI-35\r\n- Task ID: #35.2\r\n\r\n## Reference Isuees\r\n#{issue_id}\r\n\r\n## Migrations\r\nNO\r\n\r\n## Impacted Areas in Application\r\nList general components of the application that this PR will affect:\r\n\r\n-\r\n\r\n## SQL query and `explain`\r\nList of all queries and attach the result of each explaining query (in text, screenshot...)\r\n\r\n- Refer to [Using Explain with MySQL](https://viblo.asia/p/su-dung-explain-de-toi-uu-cau-lenh-mysql-BYjv44gmvxpV)\r\n","created_at":"2018-02-22T07:05:39Z","updated_at":"2018-02-23T04:41:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a03bbf808a1f6ae21dfcc1732a78141cef63d71d","assignee":{"login":"at-nhuibo","id":10772428,"avatar_url":"https://avatars3.githubusercontent.com/u/10772428?v=4","gravatar_id":"","url":"https://api.github.com/users/at-nhuibo","html_url":"https://github.com/at-nhuibo","followers_url":"https://api.github.com/users/at-nhuibo/followers","following_url":"https://api.github.com/users/at-nhuibo/following{/other_user}","gists_url":"https://api.github.com/users/at-nhuibo/gists{/gist_id}","starred_url":"https://api.github.com/users/at-nhuibo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-nhuibo/subscriptions","organizations_url":"https://api.github.com/users/at-nhuibo/orgs","repos_url":"https://api.github.com/users/at-nhuibo/repos","events_url":"https://api.github.com/users/at-nhuibo/events{/privacy}","received_events_url":"https://api.github.com/users/at-nhuibo/received_events","type":"User","site_admin":false},"assignees":[{"login":"at-nhuibo","id":10772428,"avatar_url":"https://avatars3.githubusercontent.com/u/10772428?v=4","gravatar_id":"","url":"https://api.github.com/users/at-nhuibo","html_url":"https://github.com/at-nhuibo","followers_url":"https://api.github.com/users/at-nhuibo/followers","following_url":"https://api.github.com/users/at-nhuibo/following{/other_user}","gists_url":"https://api.github.com/users/at-nhuibo/gists{/gist_id}","starred_url":"https://api.github.com/users/at-nhuibo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-nhuibo/subscriptions","organizations_url":"https://api.github.com/users/at-nhuibo/orgs","repos_url":"https://api.github.com/users/at-nhuibo/repos","events_url":"https://api.github.com/users/at-nhuibo/events{/privacy}","received_events_url":"https://api.github.com/users/at-nhuibo/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":787372577,"url":"https://api.github.com/repos/AT-PHPIntership/book-library/labels/sprint-3","name":"sprint-3","color":"cc317c","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/AT-PHPIntership/book-library/pulls/191/commits","review_comments_url":"https://api.github.com/repos/AT-PHPIntership/book-library/pulls/191/comments","review_comment_url":"https://api.github.com/repos/AT-PHPIntership/book-library/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AT-PHPIntership/book-library/issues/191/comments","statuses_url":"https://api.github.com/repos/AT-PHPIntership/book-library/statuses/9da6bc857ade9700494c9f8e833317adc91f660d","head":{"label":"AT-PHPIntership:top_10_book_review_api","ref":"top_10_book_review_api","sha":"9da6bc857ade9700494c9f8e833317adc91f660d","user":{"login":"AT-PHPIntership","id":17865237,"avatar_url":"https://avatars1.githubusercontent.com/u/17865237?v=4","gravatar_id":"","url":"https://api.github.com/users/AT-PHPIntership","html_url":"https://github.com/AT-PHPIntership","followers_url":"https://api.github.com/users/AT-PHPIntership/followers","following_url":"https://api.github.com/users/AT-PHPIntership/following{/other_user}","gists_url":"https://api.github.com/users/AT-PHPIntership/gists{/gist_id}","starred_url":"https://api.github.com/users/AT-PHPIntership/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AT-PHPIntership/subscriptions","organizations_url":"https://api.github.com/users/AT-PHPIntership/orgs","repos_url":"https://api.github.com/users/AT-PHPIntership/repos","events_url":"https://api.github.com/users/AT-PHPIntership/events{/privacy}","received_events_url":"https://api.github.com/users/AT-PHPIntership/received_events","type":"Organization","site_admin":false},"repo":{"id":115322121,"name":"book-library","full_name":"AT-PHPIntership/book-library","owner":{"login":"AT-PHPIntership","id":17865237,"avatar_url":"https://avatars1.githubusercontent.com/u/17865237?v=4","gravatar_id":"","url":"https://api.github.com/users/AT-PHPIntership","html_url":"https://github.com/AT-PHPIntership","followers_url":"https://api.github.com/users/AT-PHPIntership/followers","following_url":"https://api.github.com/users/AT-PHPIntership/following{/other_user}","gists_url":"https://api.github.com/users/AT-PHPIntership/gists{/gist_id}","starred_url":"https://api.github.com/users/AT-PHPIntership/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AT-PHPIntership/subscriptions","organizations_url":"https://api.github.com/users/AT-PHPIntership/orgs","repos_url":"https://api.github.com/users/AT-PHPIntership/repos","events_url":"https://api.github.com/users/AT-PHPIntership/events{/privacy}","received_events_url":"https://api.github.com/users/AT-PHPIntership/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AT-PHPIntership/book-library","description":null,"fork":false,"url":"https://api.github.com/repos/AT-PHPIntership/book-library","forks_url":"https://api.github.com/repos/AT-PHPIntership/book-library/forks","keys_url":"https://api.github.com/repos/AT-PHPIntership/book-library/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AT-PHPIntership/book-library/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AT-PHPIntership/book-library/teams","hooks_url":"https://api.github.com/repos/AT-PHPIntership/book-library/hooks","issue_events_url":"https://api.github.com/repos/AT-PHPIntership/book-library/issues/events{/number}","events_url":"https://api.github.com/repos/AT-PHPIntership/book-library/events","assignees_url":"https://api.github.com/repos/AT-PHPIntership/book-library/assignees{/user}","branches_url":"https://api.github.com/repos/AT-PHPIntership/book-library/branches{/branch}","tags_url":"https://api.github.com/repos/AT-PHPIntership/book-library/tags","blobs_url":"https://api.github.com/repos/AT-PHPIntership/book-library/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AT-PHPIntership/book-library/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AT-PHPIntership/book-library/git/refs{/sha}","trees_url":"https://api.github.com/repos/AT-PHPIntership/book-library/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AT-PHPIntership/book-library/statuses/{sha}","languages_url":"https://api.github.com/repos/AT-PHPIntership/book-library/languages","stargazers_url":"https://api.github.com/repos/AT-PHPIntership/book-library/stargazers","contributors_url":"https://api.github.com/repos/AT-PHPIntership/book-library/contributors","subscribers_url":"https://api.github.com/repos/AT-PHPIntership/book-library/subscribers","subscription_url":"https://api.github.com/repos/AT-PHPIntership/book-library/subscription","commits_url":"https://api.github.com/repos/AT-PHPIntership/book-library/commits{/sha}","git_commits_url":"https://api.github.com/repos/AT-PHPIntership/book-library/git/commits{/sha}","comments_url":"https://api.github.com/repos/AT-PHPIntership/book-library/comments{/number}","issue_comment_url":"https://api.github.com/repos/AT-PHPIntership/book-library/issues/comments{/number}","contents_url":"https://api.github.com/repos/AT-PHPIntership/book-library/contents/{+path}","compare_url":"https://api.github.com/repos/AT-PHPIntership/book-library/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AT-PHPIntership/book-library/merges","archive_url":"https://api.github.com/repos/AT-PHPIntership/book-library/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AT-PHPIntership/book-library/downloads","issues_url":"https://api.github.com/repos/AT-PHPIntership/book-library/issues{/number}","pulls_url":"https://api.github.com/repos/AT-PHPIntership/book-library/pulls{/number}","milestones_url":"https://api.github.com/repos/AT-PHPIntership/book-library/milestones{/number}","notifications_url":"https://api.github.com/repos/AT-PHPIntership/book-library/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AT-PHPIntership/book-library/labels{/name}","releases_url":"https://api.github.com/repos/AT-PHPIntership/book-library/releases{/id}","deployments_url":"https://api.github.com/repos/AT-PHPIntership/book-library/deployments","created_at":"2017-12-25T08:40:48Z","updated_at":"2018-02-05T03:26:53Z","pushed_at":"2018-02-23T03:11:34Z","git_url":"git://github.com/AT-PHPIntership/book-library.git","ssh_url":"git@github.com:AT-PHPIntership/book-library.git","clone_url":"https://github.com/AT-PHPIntership/book-library.git","svn_url":"https://github.com/AT-PHPIntership/book-library","homepage":null,"size":7880,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":22,"license":null,"forks":0,"open_issues":22,"watchers":0,"default_branch":"master"}},"base":{"label":"AT-PHPIntership:master","ref":"master","sha":"4be220addeaa2f28d0c882a69bf639dede5f8ffc","user":{"login":"AT-PHPIntership","id":17865237,"avatar_url":"https://avatars1.githubusercontent.com/u/17865237?v=4","gravatar_id":"","url":"https://api.github.com/users/AT-PHPIntership","html_url":"https://github.com/AT-PHPIntership","followers_url":"https://api.github.com/users/AT-PHPIntership/followers","following_url":"https://api.github.com/users/AT-PHPIntership/following{/other_user}","gists_url":"https://api.github.com/users/AT-PHPIntership/gists{/gist_id}","starred_url":"https://api.github.com/users/AT-PHPIntership/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AT-PHPIntership/subscriptions","organizations_url":"https://api.github.com/users/AT-PHPIntership/orgs","repos_url":"https://api.github.com/users/AT-PHPIntership/repos","events_url":"https://api.github.com/users/AT-PHPIntership/events{/privacy}","received_events_url":"https://api.github.com/users/AT-PHPIntership/received_events","type":"Organization","site_admin":false},"repo":{"id":115322121,"name":"book-library","full_name":"AT-PHPIntership/book-library","owner":{"login":"AT-PHPIntership","id":17865237,"avatar_url":"https://avatars1.githubusercontent.com/u/17865237?v=4","gravatar_id":"","url":"https://api.github.com/users/AT-PHPIntership","html_url":"https://github.com/AT-PHPIntership","followers_url":"https://api.github.com/users/AT-PHPIntership/followers","following_url":"https://api.github.com/users/AT-PHPIntership/following{/other_user}","gists_url":"https://api.github.com/users/AT-PHPIntership/gists{/gist_id}","starred_url":"https://api.github.com/users/AT-PHPIntership/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AT-PHPIntership/subscriptions","organizations_url":"https://api.github.com/users/AT-PHPIntership/orgs","repos_url":"https://api.github.com/users/AT-PHPIntership/repos","events_url":"https://api.github.com/users/AT-PHPIntership/events{/privacy}","received_events_url":"https://api.github.com/users/AT-PHPIntership/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AT-PHPIntership/book-library","description":null,"fork":false,"url":"https://api.github.com/repos/AT-PHPIntership/book-library","forks_url":"https://api.github.com/repos/AT-PHPIntership/book-library/forks","keys_url":"https://api.github.com/repos/AT-PHPIntership/book-library/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AT-PHPIntership/book-library/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AT-PHPIntership/book-library/teams","hooks_url":"https://api.github.com/repos/AT-PHPIntership/book-library/hooks","issue_events_url":"https://api.github.com/repos/AT-PHPIntership/book-library/issues/events{/number}","events_url":"https://api.github.com/repos/AT-PHPIntership/book-library/events","assignees_url":"https://api.github.com/repos/AT-PHPIntership/book-library/assignees{/user}","branches_url":"https://api.github.com/repos/AT-PHPIntership/book-library/branches{/branch}","tags_url":"https://api.github.com/repos/AT-PHPIntership/book-library/tags","blobs_url":"https://api.github.com/repos/AT-PHPIntership/book-library/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AT-PHPIntership/book-library/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AT-PHPIntership/book-library/git/refs{/sha}","trees_url":"https://api.github.com/repos/AT-PHPIntership/book-library/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AT-PHPIntership/book-library/statuses/{sha}","languages_url":"https://api.github.com/repos/AT-PHPIntership/book-library/languages","stargazers_url":"https://api.github.com/repos/AT-PHPIntership/book-library/stargazers","contributors_url":"https://api.github.com/repos/AT-PHPIntership/book-library/contributors","subscribers_url":"https://api.github.com/repos/AT-PHPIntership/book-library/subscribers","subscription_url":"https://api.github.com/repos/AT-PHPIntership/book-library/subscription","commits_url":"https://api.github.com/repos/AT-PHPIntership/book-library/commits{/sha}","git_commits_url":"https://api.github.com/repos/AT-PHPIntership/book-library/git/commits{/sha}","comments_url":"https://api.github.com/repos/AT-PHPIntership/book-library/comments{/number}","issue_comment_url":"https://api.github.com/repos/AT-PHPIntership/book-library/issues/comments{/number}","contents_url":"https://api.github.com/repos/AT-PHPIntership/book-library/contents/{+path}","compare_url":"https://api.github.com/repos/AT-PHPIntership/book-library/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AT-PHPIntership/book-library/merges","archive_url":"https://api.github.com/repos/AT-PHPIntership/book-library/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AT-PHPIntership/book-library/downloads","issues_url":"https://api.github.com/repos/AT-PHPIntership/book-library/issues{/number}","pulls_url":"https://api.github.com/repos/AT-PHPIntership/book-library/pulls{/number}","milestones_url":"https://api.github.com/repos/AT-PHPIntership/book-library/milestones{/number}","notifications_url":"https://api.github.com/repos/AT-PHPIntership/book-library/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AT-PHPIntership/book-library/labels{/name}","releases_url":"https://api.github.com/repos/AT-PHPIntership/book-library/releases{/id}","deployments_url":"https://api.github.com/repos/AT-PHPIntership/book-library/deployments","created_at":"2017-12-25T08:40:48Z","updated_at":"2018-02-05T03:26:53Z","pushed_at":"2018-02-23T03:11:34Z","git_url":"git://github.com/AT-PHPIntership/book-library.git","ssh_url":"git@github.com:AT-PHPIntership/book-library.git","clone_url":"https://github.com/AT-PHPIntership/book-library.git","svn_url":"https://github.com/AT-PHPIntership/book-library","homepage":null,"size":7880,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":22,"license":null,"forks":0,"open_issues":22,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/AT-PHPIntership/book-library/pulls/191"},"html":{"href":"https://github.com/AT-PHPIntership/book-library/pull/191"},"issue":{"href":"https://api.github.com/repos/AT-PHPIntership/book-library/issues/191"},"comments":{"href":"https://api.github.com/repos/AT-PHPIntership/book-library/issues/191/comments"},"review_comments":{"href":"https://api.github.com/repos/AT-PHPIntership/book-library/pulls/191/comments"},"review_comment":{"href":"https://api.github.com/repos/AT-PHPIntership/book-library/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AT-PHPIntership/book-library/pulls/191/commits"},"statuses":{"href":"https://api.github.com/repos/AT-PHPIntership/book-library/statuses/9da6bc857ade9700494c9f8e833317adc91f660d"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"at-nhuibo"}}