{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/fels_184/pulls/comments/78679006","id":78679006,"diff_hunk":"@@ -21,20 +26,63 @@ public static function filterWords($type = self::TYPE_FILTER_WORDS_ALL)\n                 return self::getLearnedWords();\n             case self::TYPE_FILTER_WORDS_UNLEARN:\n                 return self::getUnlearnedWords();\n+            case self::TYPE_FILTER_WORDS_CATEGORY:\n+                return self::getWordsByCategory($category_id);\n \n             default:\n                 return self::getAllWords();\n         }\n     }\n \n+    public static function filterLessons($type = self::TYPE_FILTER_WORDS_ALL, $category_id = null)\n+    {\n+        switch ($type) {\n+            case self::TYPE_FILTER_CATEGORY_LESSON:\n+                return self::getLessonsByCategory($category_id);\n+\n+            default:\n+                return self::getAllLessons();\n+        }\n+    }\n+\n     public static function getAllWords()\n     {\n-        return Answer::where('is_correct', config('word.answer.correct'))->orderby('created_at')->paginate(config('paginate.word.normal'), ['*'], 'wordlist_page');\n+        return Word::with('answers')\n+        ->orderby('content')\n+        ->paginate(config('paginate.word.normal'), ['*'], 'wordlist_page');\n+    }\n+\n+    public static function getCategoryTitle($category_id)\n+    {\n+        if ($category_id == null) {\n+            return trans('homepage.title_lesson');\n+        }\n+\n+        return Category::where('id', $category_id)->first()->name;\n+    }\n+\n+    public static function getAllLessons()\n+    {\n+        return Lesson::orderby('created_at', 'desc')->paginate(config('paginate.lesson.normal'));\n     }\n \n     public static function getNewWords()\n     {\n-        return Answer::where('is_correct', config('word.answer.correct'))->orderby('created_at', 'desc')->paginate(config('paginate.word.normal'), ['*'], 'wordlist_page');\n+        return Answer::where('id', '<', 80)->where('is_correct', config('word.answer.correct'))->orderby('created_at')->paginate(config('paginate.word.normal'), ['*'], 'wordlist_page');\n+    }\n+\n+    public static function getWordsByCategory($category_id)","path":"app/Services/HomeService.php","position":78,"original_position":78,"commit_id":"47959d713c6486213478e261e5a17b25303369b2","original_commit_id":"47959d713c6486213478e261e5a17b25303369b2","user":{"login":"NgTheThao","id":11207197,"avatar_url":"https://avatars.githubusercontent.com/u/11207197?v=3","gravatar_id":"","url":"https://api.github.com/users/NgTheThao","html_url":"https://github.com/NgTheThao","followers_url":"https://api.github.com/users/NgTheThao/followers","following_url":"https://api.github.com/users/NgTheThao/following{/other_user}","gists_url":"https://api.github.com/users/NgTheThao/gists{/gist_id}","starred_url":"https://api.github.com/users/NgTheThao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NgTheThao/subscriptions","organizations_url":"https://api.github.com/users/NgTheThao/orgs","repos_url":"https://api.github.com/users/NgTheThao/repos","events_url":"https://api.github.com/users/NgTheThao/events{/privacy}","received_events_url":"https://api.github.com/users/NgTheThao/received_events","type":"User","site_admin":false},"body":"`$categoryId`","created_at":"2016-09-14T02:47:13Z","updated_at":"2016-09-14T02:47:13Z","html_url":"https://github.com/framgia/fels_184/pull/10#discussion_r78679006","pull_request_url":"https://api.github.com/repos/framgia/fels_184/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/framgia/fels_184/pulls/comments/78679006"},"html":{"href":"https://github.com/framgia/fels_184/pull/10#discussion_r78679006"},"pull_request":{"href":"https://api.github.com/repos/framgia/fels_184/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/fels_184/pulls/10","id":85152334,"html_url":"https://github.com/framgia/fels_184/pull/10","diff_url":"https://github.com/framgia/fels_184/pull/10.diff","patch_url":"https://github.com/framgia/fels_184/pull/10.patch","issue_url":"https://api.github.com/repos/framgia/fels_184/issues/10","number":10,"state":"open","locked":false,"title":"Filter Category, Get Alphabe Word Filter And Paginate","user":{"login":"thandongtb","id":7605345,"avatar_url":"https://avatars.githubusercontent.com/u/7605345?v=3","gravatar_id":"","url":"https://api.github.com/users/thandongtb","html_url":"https://github.com/thandongtb","followers_url":"https://api.github.com/users/thandongtb/followers","following_url":"https://api.github.com/users/thandongtb/following{/other_user}","gists_url":"https://api.github.com/users/thandongtb/gists{/gist_id}","starred_url":"https://api.github.com/users/thandongtb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thandongtb/subscriptions","organizations_url":"https://api.github.com/users/thandongtb/orgs","repos_url":"https://api.github.com/users/thandongtb/repos","events_url":"https://api.github.com/users/thandongtb/events{/privacy}","received_events_url":"https://api.github.com/users/thandongtb/received_events","type":"User","site_admin":false},"body":"Tạo bộ lọc cho việc lọc bài học và các từ theo tiêu Category, làm phần bộ lọc theo tiêu chí alphabe của từ đồng thời xử lý phân trang cho các kết quả sau khi áp dụng bộ lọc","created_at":"2016-09-14T01:15:14Z","updated_at":"2016-09-14T02:47:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e37f8a9623f8f5f03ea1f3acfb59a89877862c71","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/framgia/fels_184/pulls/10/commits","review_comments_url":"https://api.github.com/repos/framgia/fels_184/pulls/10/comments","review_comment_url":"https://api.github.com/repos/framgia/fels_184/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/fels_184/issues/10/comments","statuses_url":"https://api.github.com/repos/framgia/fels_184/statuses/47959d713c6486213478e261e5a17b25303369b2","head":{"label":"thandongtb:filterCategory","ref":"filterCategory","sha":"47959d713c6486213478e261e5a17b25303369b2","user":{"login":"thandongtb","id":7605345,"avatar_url":"https://avatars.githubusercontent.com/u/7605345?v=3","gravatar_id":"","url":"https://api.github.com/users/thandongtb","html_url":"https://github.com/thandongtb","followers_url":"https://api.github.com/users/thandongtb/followers","following_url":"https://api.github.com/users/thandongtb/following{/other_user}","gists_url":"https://api.github.com/users/thandongtb/gists{/gist_id}","starred_url":"https://api.github.com/users/thandongtb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thandongtb/subscriptions","organizations_url":"https://api.github.com/users/thandongtb/orgs","repos_url":"https://api.github.com/users/thandongtb/repos","events_url":"https://api.github.com/users/thandongtb/events{/privacy}","received_events_url":"https://api.github.com/users/thandongtb/received_events","type":"User","site_admin":false},"repo":{"id":67665999,"name":"fels_184","full_name":"thandongtb/fels_184","owner":{"login":"thandongtb","id":7605345,"avatar_url":"https://avatars.githubusercontent.com/u/7605345?v=3","gravatar_id":"","url":"https://api.github.com/users/thandongtb","html_url":"https://github.com/thandongtb","followers_url":"https://api.github.com/users/thandongtb/followers","following_url":"https://api.github.com/users/thandongtb/following{/other_user}","gists_url":"https://api.github.com/users/thandongtb/gists{/gist_id}","starred_url":"https://api.github.com/users/thandongtb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thandongtb/subscriptions","organizations_url":"https://api.github.com/users/thandongtb/orgs","repos_url":"https://api.github.com/users/thandongtb/repos","events_url":"https://api.github.com/users/thandongtb/events{/privacy}","received_events_url":"https://api.github.com/users/thandongtb/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thandongtb/fels_184","description":"Framgia E-Learning System (training)","fork":true,"url":"https://api.github.com/repos/thandongtb/fels_184","forks_url":"https://api.github.com/repos/thandongtb/fels_184/forks","keys_url":"https://api.github.com/repos/thandongtb/fels_184/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thandongtb/fels_184/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thandongtb/fels_184/teams","hooks_url":"https://api.github.com/repos/thandongtb/fels_184/hooks","issue_events_url":"https://api.github.com/repos/thandongtb/fels_184/issues/events{/number}","events_url":"https://api.github.com/repos/thandongtb/fels_184/events","assignees_url":"https://api.github.com/repos/thandongtb/fels_184/assignees{/user}","branches_url":"https://api.github.com/repos/thandongtb/fels_184/branches{/branch}","tags_url":"https://api.github.com/repos/thandongtb/fels_184/tags","blobs_url":"https://api.github.com/repos/thandongtb/fels_184/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thandongtb/fels_184/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thandongtb/fels_184/git/refs{/sha}","trees_url":"https://api.github.com/repos/thandongtb/fels_184/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thandongtb/fels_184/statuses/{sha}","languages_url":"https://api.github.com/repos/thandongtb/fels_184/languages","stargazers_url":"https://api.github.com/repos/thandongtb/fels_184/stargazers","contributors_url":"https://api.github.com/repos/thandongtb/fels_184/contributors","subscribers_url":"https://api.github.com/repos/thandongtb/fels_184/subscribers","subscription_url":"https://api.github.com/repos/thandongtb/fels_184/subscription","commits_url":"https://api.github.com/repos/thandongtb/fels_184/commits{/sha}","git_commits_url":"https://api.github.com/repos/thandongtb/fels_184/git/commits{/sha}","comments_url":"https://api.github.com/repos/thandongtb/fels_184/comments{/number}","issue_comment_url":"https://api.github.com/repos/thandongtb/fels_184/issues/comments{/number}","contents_url":"https://api.github.com/repos/thandongtb/fels_184/contents/{+path}","compare_url":"https://api.github.com/repos/thandongtb/fels_184/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thandongtb/fels_184/merges","archive_url":"https://api.github.com/repos/thandongtb/fels_184/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thandongtb/fels_184/downloads","issues_url":"https://api.github.com/repos/thandongtb/fels_184/issues{/number}","pulls_url":"https://api.github.com/repos/thandongtb/fels_184/pulls{/number}","milestones_url":"https://api.github.com/repos/thandongtb/fels_184/milestones{/number}","notifications_url":"https://api.github.com/repos/thandongtb/fels_184/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thandongtb/fels_184/labels{/name}","releases_url":"https://api.github.com/repos/thandongtb/fels_184/releases{/id}","deployments_url":"https://api.github.com/repos/thandongtb/fels_184/deployments","created_at":"2016-09-08T03:42:27Z","updated_at":"2016-09-08T10:22:05Z","pushed_at":"2016-09-14T02:30:38Z","git_url":"git://github.com/thandongtb/fels_184.git","ssh_url":"git@github.com:thandongtb/fels_184.git","clone_url":"https://github.com/thandongtb/fels_184.git","svn_url":"https://github.com/thandongtb/fels_184","homepage":"","size":214,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"framgia:develop","ref":"develop","sha":"5b72a4f6d0b5f2df6c80ff35b1f0acbdd27355c6","user":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"repo":{"id":67661519,"name":"fels_184","full_name":"framgia/fels_184","owner":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/framgia/fels_184","description":"Framgia E-Learning System (training)","fork":false,"url":"https://api.github.com/repos/framgia/fels_184","forks_url":"https://api.github.com/repos/framgia/fels_184/forks","keys_url":"https://api.github.com/repos/framgia/fels_184/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/fels_184/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/fels_184/teams","hooks_url":"https://api.github.com/repos/framgia/fels_184/hooks","issue_events_url":"https://api.github.com/repos/framgia/fels_184/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/fels_184/events","assignees_url":"https://api.github.com/repos/framgia/fels_184/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/fels_184/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/fels_184/tags","blobs_url":"https://api.github.com/repos/framgia/fels_184/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/fels_184/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/fels_184/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/fels_184/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/fels_184/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/fels_184/languages","stargazers_url":"https://api.github.com/repos/framgia/fels_184/stargazers","contributors_url":"https://api.github.com/repos/framgia/fels_184/contributors","subscribers_url":"https://api.github.com/repos/framgia/fels_184/subscribers","subscription_url":"https://api.github.com/repos/framgia/fels_184/subscription","commits_url":"https://api.github.com/repos/framgia/fels_184/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/fels_184/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/fels_184/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/fels_184/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/fels_184/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/fels_184/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/fels_184/merges","archive_url":"https://api.github.com/repos/framgia/fels_184/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/fels_184/downloads","issues_url":"https://api.github.com/repos/framgia/fels_184/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/fels_184/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/fels_184/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/fels_184/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/fels_184/labels{/name}","releases_url":"https://api.github.com/repos/framgia/fels_184/releases{/id}","deployments_url":"https://api.github.com/repos/framgia/fels_184/deployments","created_at":"2016-09-08T02:36:13Z","updated_at":"2016-09-08T02:36:13Z","pushed_at":"2016-09-14T02:30:38Z","git_url":"git://github.com/framgia/fels_184.git","ssh_url":"git@github.com:framgia/fels_184.git","clone_url":"https://github.com/framgia/fels_184.git","svn_url":"https://github.com/framgia/fels_184","homepage":null,"size":216,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/fels_184/pulls/10"},"html":{"href":"https://github.com/framgia/fels_184/pull/10"},"issue":{"href":"https://api.github.com/repos/framgia/fels_184/issues/10"},"comments":{"href":"https://api.github.com/repos/framgia/fels_184/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/fels_184/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/fels_184/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/fels_184/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/fels_184/statuses/47959d713c6486213478e261e5a17b25303369b2"}}}}
{"actor":{"display_login":"NgTheThao"}}