{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/fels_84/pulls/comments/44905344","id":44905344,"diff_hunk":"@@ -1,36 +1,50 @@\n-<?php namespace App\\Http\\Controllers;\n+<?php \n \n-class HomeController extends Controller {\n+namespace App\\Http\\Controllers;\n \n-\t/*\n-\t|--------------------------------------------------------------------------\n-\t| Home Controller\n-\t|--------------------------------------------------------------------------\n-\t|\n-\t| This controller renders your application's \"dashboard\" for users that\n-\t| are authenticated. Of course, you are free to change or remove the\n-\t| controller as you wish. It is just here to get your app started!\n-\t|\n-\t*/\n+use Illuminate\\Http\\Request;\n+use App\\Http\\Requests;\n+use App\\Http\\Controllers\\Controller;\n+use Auth;\n+use DB;\n+use App\\User;\n+use App\\Activity;\n+use App\\Lesson;\n+use Config;\n \n-\t/**\n-\t * Create a new controller instance.\n-\t *\n-\t * @return void\n-\t */\n-\tpublic function __construct()\n-\t{\n-\t\t$this->middleware('auth');\n-\t}\n+class HomeController extends Controller \n+{\n+    /**\n+     * Create a new controller instance.\n+     *\n+     * @return void\n+     */\n+    public function __construct()\n+    {\n+        $this->middleware('auth');\n+    }\n \n-\t/**\n-\t * Show the application dashboard to the user.\n-\t *\n-\t * @return Response\n-\t */\n-\tpublic function index()\n-\t{\n-\t\treturn view('home');\n-\t}\n+    /**\n+     * Show the application dashboard to the user.\n+     *\n+     * @return Response\n+     */\n+    public function index()\n+    {\n+        $users = User::find(Auth::user()->id);\n+        $followeds  = DB::table('activities')\n+                        ->join('users', 'users.id', '=', 'activities.followed_id')\n+                        ->where('follower_id', Auth::user()->id)\n+                        ->select('activities.followed_id', 'users.*')\n+                        ->get();","path":"app/Http/Controllers/HomeController.php","position":69,"original_position":69,"commit_id":"84f9f90ffd0f2cb36e729590361ccc0fb180cd29","original_commit_id":"84f9f90ffd0f2cb36e729590361ccc0fb180cd29","user":{"login":"wataridori","id":1189893,"avatar_url":"https://avatars.githubusercontent.com/u/1189893?v=3","gravatar_id":"","url":"https://api.github.com/users/wataridori","html_url":"https://github.com/wataridori","followers_url":"https://api.github.com/users/wataridori/followers","following_url":"https://api.github.com/users/wataridori/following{/other_user}","gists_url":"https://api.github.com/users/wataridori/gists{/gist_id}","starred_url":"https://api.github.com/users/wataridori/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wataridori/subscriptions","organizations_url":"https://api.github.com/users/wataridori/orgs","repos_url":"https://api.github.com/users/wataridori/repos","events_url":"https://api.github.com/users/wataridori/events{/privacy}","received_events_url":"https://api.github.com/users/wataridori/received_events","type":"User","site_admin":false},"body":"Em định nghĩa các quan hệ `hasMany`, `belongsToMany`, ... trong model đi, sao lại phải lấy dữ liệu ra bằng QueryBuilder thế này.\r\nhttp://laravel.com/docs/5.1/eloquent-relationships","created_at":"2015-11-16T10:02:31Z","updated_at":"2015-11-16T10:02:31Z","html_url":"https://github.com/framgia/fels_84/pull/9#discussion_r44905344","pull_request_url":"https://api.github.com/repos/framgia/fels_84/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/framgia/fels_84/pulls/comments/44905344"},"html":{"href":"https://github.com/framgia/fels_84/pull/9#discussion_r44905344"},"pull_request":{"href":"https://api.github.com/repos/framgia/fels_84/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/fels_84/pulls/9","id":50789986,"html_url":"https://github.com/framgia/fels_84/pull/9","diff_url":"https://github.com/framgia/fels_84/pull/9.diff","patch_url":"https://github.com/framgia/fels_84/pull/9.patch","issue_url":"https://api.github.com/repos/framgia/fels_84/issues/9","number":9,"state":"open","locked":false,"title":"home-page frontend","user":{"login":"tieppt07","id":9419172,"avatar_url":"https://avatars.githubusercontent.com/u/9419172?v=3","gravatar_id":"","url":"https://api.github.com/users/tieppt07","html_url":"https://github.com/tieppt07","followers_url":"https://api.github.com/users/tieppt07/followers","following_url":"https://api.github.com/users/tieppt07/following{/other_user}","gists_url":"https://api.github.com/users/tieppt07/gists{/gist_id}","starred_url":"https://api.github.com/users/tieppt07/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tieppt07/subscriptions","organizations_url":"https://api.github.com/users/tieppt07/orgs","repos_url":"https://api.github.com/users/tieppt07/repos","events_url":"https://api.github.com/users/tieppt07/events{/privacy}","received_events_url":"https://api.github.com/users/tieppt07/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-16T09:58:07Z","updated_at":"2015-11-16T10:02:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c295a51a5a3d862c9f313af546c4a2af20b30df4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/framgia/fels_84/pulls/9/commits","review_comments_url":"https://api.github.com/repos/framgia/fels_84/pulls/9/comments","review_comment_url":"https://api.github.com/repos/framgia/fels_84/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/fels_84/issues/9/comments","statuses_url":"https://api.github.com/repos/framgia/fels_84/statuses/84f9f90ffd0f2cb36e729590361ccc0fb180cd29","head":{"label":"tieppt07:home_page","ref":"home_page","sha":"84f9f90ffd0f2cb36e729590361ccc0fb180cd29","user":{"login":"tieppt07","id":9419172,"avatar_url":"https://avatars.githubusercontent.com/u/9419172?v=3","gravatar_id":"","url":"https://api.github.com/users/tieppt07","html_url":"https://github.com/tieppt07","followers_url":"https://api.github.com/users/tieppt07/followers","following_url":"https://api.github.com/users/tieppt07/following{/other_user}","gists_url":"https://api.github.com/users/tieppt07/gists{/gist_id}","starred_url":"https://api.github.com/users/tieppt07/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tieppt07/subscriptions","organizations_url":"https://api.github.com/users/tieppt07/orgs","repos_url":"https://api.github.com/users/tieppt07/repos","events_url":"https://api.github.com/users/tieppt07/events{/privacy}","received_events_url":"https://api.github.com/users/tieppt07/received_events","type":"User","site_admin":false},"repo":{"id":45011288,"name":"fels_84","full_name":"tieppt07/fels_84","owner":{"login":"tieppt07","id":9419172,"avatar_url":"https://avatars.githubusercontent.com/u/9419172?v=3","gravatar_id":"","url":"https://api.github.com/users/tieppt07","html_url":"https://github.com/tieppt07","followers_url":"https://api.github.com/users/tieppt07/followers","following_url":"https://api.github.com/users/tieppt07/following{/other_user}","gists_url":"https://api.github.com/users/tieppt07/gists{/gist_id}","starred_url":"https://api.github.com/users/tieppt07/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tieppt07/subscriptions","organizations_url":"https://api.github.com/users/tieppt07/orgs","repos_url":"https://api.github.com/users/tieppt07/repos","events_url":"https://api.github.com/users/tieppt07/events{/privacy}","received_events_url":"https://api.github.com/users/tieppt07/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tieppt07/fels_84","description":"Framgia E-Learning System (training)","fork":true,"url":"https://api.github.com/repos/tieppt07/fels_84","forks_url":"https://api.github.com/repos/tieppt07/fels_84/forks","keys_url":"https://api.github.com/repos/tieppt07/fels_84/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tieppt07/fels_84/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tieppt07/fels_84/teams","hooks_url":"https://api.github.com/repos/tieppt07/fels_84/hooks","issue_events_url":"https://api.github.com/repos/tieppt07/fels_84/issues/events{/number}","events_url":"https://api.github.com/repos/tieppt07/fels_84/events","assignees_url":"https://api.github.com/repos/tieppt07/fels_84/assignees{/user}","branches_url":"https://api.github.com/repos/tieppt07/fels_84/branches{/branch}","tags_url":"https://api.github.com/repos/tieppt07/fels_84/tags","blobs_url":"https://api.github.com/repos/tieppt07/fels_84/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tieppt07/fels_84/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tieppt07/fels_84/git/refs{/sha}","trees_url":"https://api.github.com/repos/tieppt07/fels_84/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tieppt07/fels_84/statuses/{sha}","languages_url":"https://api.github.com/repos/tieppt07/fels_84/languages","stargazers_url":"https://api.github.com/repos/tieppt07/fels_84/stargazers","contributors_url":"https://api.github.com/repos/tieppt07/fels_84/contributors","subscribers_url":"https://api.github.com/repos/tieppt07/fels_84/subscribers","subscription_url":"https://api.github.com/repos/tieppt07/fels_84/subscription","commits_url":"https://api.github.com/repos/tieppt07/fels_84/commits{/sha}","git_commits_url":"https://api.github.com/repos/tieppt07/fels_84/git/commits{/sha}","comments_url":"https://api.github.com/repos/tieppt07/fels_84/comments{/number}","issue_comment_url":"https://api.github.com/repos/tieppt07/fels_84/issues/comments{/number}","contents_url":"https://api.github.com/repos/tieppt07/fels_84/contents/{+path}","compare_url":"https://api.github.com/repos/tieppt07/fels_84/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tieppt07/fels_84/merges","archive_url":"https://api.github.com/repos/tieppt07/fels_84/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tieppt07/fels_84/downloads","issues_url":"https://api.github.com/repos/tieppt07/fels_84/issues{/number}","pulls_url":"https://api.github.com/repos/tieppt07/fels_84/pulls{/number}","milestones_url":"https://api.github.com/repos/tieppt07/fels_84/milestones{/number}","notifications_url":"https://api.github.com/repos/tieppt07/fels_84/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tieppt07/fels_84/labels{/name}","releases_url":"https://api.github.com/repos/tieppt07/fels_84/releases{/id}","created_at":"2015-10-27T02:21:27Z","updated_at":"2015-10-26T08:46:03Z","pushed_at":"2015-11-16T09:57:13Z","git_url":"git://github.com/tieppt07/fels_84.git","ssh_url":"git@github.com:tieppt07/fels_84.git","clone_url":"https://github.com/tieppt07/fels_84.git","svn_url":"https://github.com/tieppt07/fels_84","homepage":null,"size":325,"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":"develop"}},"base":{"label":"framgia:develop","ref":"develop","sha":"0e98961dc69b2372094048732b3f1a3239f3616a","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":44956202,"name":"fels_84","full_name":"framgia/fels_84","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_84","description":"Framgia E-Learning System (training)","fork":false,"url":"https://api.github.com/repos/framgia/fels_84","forks_url":"https://api.github.com/repos/framgia/fels_84/forks","keys_url":"https://api.github.com/repos/framgia/fels_84/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/fels_84/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/fels_84/teams","hooks_url":"https://api.github.com/repos/framgia/fels_84/hooks","issue_events_url":"https://api.github.com/repos/framgia/fels_84/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/fels_84/events","assignees_url":"https://api.github.com/repos/framgia/fels_84/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/fels_84/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/fels_84/tags","blobs_url":"https://api.github.com/repos/framgia/fels_84/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/fels_84/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/fels_84/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/fels_84/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/fels_84/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/fels_84/languages","stargazers_url":"https://api.github.com/repos/framgia/fels_84/stargazers","contributors_url":"https://api.github.com/repos/framgia/fels_84/contributors","subscribers_url":"https://api.github.com/repos/framgia/fels_84/subscribers","subscription_url":"https://api.github.com/repos/framgia/fels_84/subscription","commits_url":"https://api.github.com/repos/framgia/fels_84/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/fels_84/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/fels_84/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/fels_84/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/fels_84/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/fels_84/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/fels_84/merges","archive_url":"https://api.github.com/repos/framgia/fels_84/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/fels_84/downloads","issues_url":"https://api.github.com/repos/framgia/fels_84/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/fels_84/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/fels_84/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/fels_84/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/fels_84/labels{/name}","releases_url":"https://api.github.com/repos/framgia/fels_84/releases{/id}","created_at":"2015-10-26T08:46:03Z","updated_at":"2015-10-26T08:46:03Z","pushed_at":"2015-11-16T09:58:08Z","git_url":"git://github.com/framgia/fels_84.git","ssh_url":"git@github.com:framgia/fels_84.git","clone_url":"https://github.com/framgia/fels_84.git","svn_url":"https://github.com/framgia/fels_84","homepage":null,"size":512,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/fels_84/pulls/9"},"html":{"href":"https://github.com/framgia/fels_84/pull/9"},"issue":{"href":"https://api.github.com/repos/framgia/fels_84/issues/9"},"comments":{"href":"https://api.github.com/repos/framgia/fels_84/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/fels_84/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/fels_84/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/fels_84/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/fels_84/statuses/84f9f90ffd0f2cb36e729590361ccc0fb180cd29"}}}}