{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/campaign_01/pulls/comments/131512863","pull_request_review_id":54506552,"id":131512863,"diff_hunk":"@@ -236,4 +238,67 @@ public function uploadImages(array $files, $path)\n             ->media()\n             ->createMany($uploadedFiles);\n     }\n+\n+    public function notificationWhenMakeFriend($requestId, $approvalId)\n+    {\n+        $user = $this->findOrFail($approvalId);\n+        Notification::send($user, new MakeFriend($this->findOrFail($requestId)));\n+    }\n+\n+    public function getNotifications($user, $skip, $type)\n+    {\n+        return $this->getIfUser($user)\n+            ->notifications()\n+            ->whereIn('type', is_array($type) ? $type : [$type])\n+            ->skip($skip)\n+            ->take(config('settings.paginate_notification'))\n+            ->get();\n+    }\n+\n+    public function countUnreadNotifications($user, $type)\n+    {\n+        return $this->getIfUser($user)\n+            ->unreadNotifications()\n+            ->whereIn('type', is_array($type) ? $type : [$type])\n+            ->count();\n+    }\n+\n+    public function markRead($typeNoty, $user)\n+    {\n+        $type = [];\n+\n+        if ($typeNoty == config('settings.read_notification_friend')) {\n+            $type[] = MakeFriend::class;\n+        }\n+\n+        if ($type) {\n+            $this->getIfUser($user)\n+                ->unreadNotifications()\n+                ->whereIn('type', $type)\n+                ->get()\n+                ->markAsRead();\n+        }\n+\n+        return true;\n+    }\n+\n+    public function deleteNotification($id, $user)\n+    {\n+        return $this->getIfUser($user)\n+            ->notifications()\n+            ->where([\n+                'id' => $id,\n+                'type' => MakeFriend::class,\n+            ])\n+            ->delete();\n+    }\n+\n+    private function getIfUser($user)","path":"app/Repositories/Eloquent/UserRepository.php","position":68,"original_position":68,"commit_id":"a9c08b975ecb3620079ac7595d1d2744645b64e8","original_commit_id":"a9c08b975ecb3620079ac7595d1d2744645b64e8","user":{"login":"phanngoc","id":3756788,"avatar_url":"https://avatars1.githubusercontent.com/u/3756788?v=4","gravatar_id":"","url":"https://api.github.com/users/phanngoc","html_url":"https://github.com/phanngoc","followers_url":"https://api.github.com/users/phanngoc/followers","following_url":"https://api.github.com/users/phanngoc/following{/other_user}","gists_url":"https://api.github.com/users/phanngoc/gists{/gist_id}","starred_url":"https://api.github.com/users/phanngoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phanngoc/subscriptions","organizations_url":"https://api.github.com/users/phanngoc/orgs","repos_url":"https://api.github.com/users/phanngoc/repos","events_url":"https://api.github.com/users/phanngoc/events{/privacy}","received_events_url":"https://api.github.com/users/phanngoc/received_events","type":"User","site_admin":false},"body":"good bye Vĩ","created_at":"2017-08-05T02:40:43Z","updated_at":"2017-08-05T02:40:43Z","html_url":"https://github.com/framgia/campaign_01/pull/112#discussion_r131512863","pull_request_url":"https://api.github.com/repos/framgia/campaign_01/pulls/112","_links":{"self":{"href":"https://api.github.com/repos/framgia/campaign_01/pulls/comments/131512863"},"html":{"href":"https://github.com/framgia/campaign_01/pull/112#discussion_r131512863"},"pull_request":{"href":"https://api.github.com/repos/framgia/campaign_01/pulls/112"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/campaign_01/pulls/112","id":134097775,"html_url":"https://github.com/framgia/campaign_01/pull/112","diff_url":"https://github.com/framgia/campaign_01/pull/112.diff","patch_url":"https://github.com/framgia/campaign_01/pull/112.patch","issue_url":"https://api.github.com/repos/framgia/campaign_01/issues/112","number":112,"state":"open","locked":false,"title":"notification for request make friend","user":{"login":"MinhTri1911","id":23449482,"avatar_url":"https://avatars1.githubusercontent.com/u/23449482?v=4","gravatar_id":"","url":"https://api.github.com/users/MinhTri1911","html_url":"https://github.com/MinhTri1911","followers_url":"https://api.github.com/users/MinhTri1911/followers","following_url":"https://api.github.com/users/MinhTri1911/following{/other_user}","gists_url":"https://api.github.com/users/MinhTri1911/gists{/gist_id}","starred_url":"https://api.github.com/users/MinhTri1911/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MinhTri1911/subscriptions","organizations_url":"https://api.github.com/users/MinhTri1911/orgs","repos_url":"https://api.github.com/users/MinhTri1911/repos","events_url":"https://api.github.com/users/MinhTri1911/events{/privacy}","received_events_url":"https://api.github.com/users/MinhTri1911/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-08-04T06:19:30Z","updated_at":"2017-08-05T02:40:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"24642d35b5af584ecbcbe5114d668d359ff81660","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/framgia/campaign_01/pulls/112/commits","review_comments_url":"https://api.github.com/repos/framgia/campaign_01/pulls/112/comments","review_comment_url":"https://api.github.com/repos/framgia/campaign_01/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/campaign_01/issues/112/comments","statuses_url":"https://api.github.com/repos/framgia/campaign_01/statuses/a9c08b975ecb3620079ac7595d1d2744645b64e8","head":{"label":"MinhTri1911:notification_request_addfriend","ref":"notification_request_addfriend","sha":"a9c08b975ecb3620079ac7595d1d2744645b64e8","user":{"login":"MinhTri1911","id":23449482,"avatar_url":"https://avatars1.githubusercontent.com/u/23449482?v=4","gravatar_id":"","url":"https://api.github.com/users/MinhTri1911","html_url":"https://github.com/MinhTri1911","followers_url":"https://api.github.com/users/MinhTri1911/followers","following_url":"https://api.github.com/users/MinhTri1911/following{/other_user}","gists_url":"https://api.github.com/users/MinhTri1911/gists{/gist_id}","starred_url":"https://api.github.com/users/MinhTri1911/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MinhTri1911/subscriptions","organizations_url":"https://api.github.com/users/MinhTri1911/orgs","repos_url":"https://api.github.com/users/MinhTri1911/repos","events_url":"https://api.github.com/users/MinhTri1911/events{/privacy}","received_events_url":"https://api.github.com/users/MinhTri1911/received_events","type":"User","site_admin":false},"repo":{"id":90598134,"name":"campaign_01","full_name":"MinhTri1911/campaign_01","owner":{"login":"MinhTri1911","id":23449482,"avatar_url":"https://avatars1.githubusercontent.com/u/23449482?v=4","gravatar_id":"","url":"https://api.github.com/users/MinhTri1911","html_url":"https://github.com/MinhTri1911","followers_url":"https://api.github.com/users/MinhTri1911/followers","following_url":"https://api.github.com/users/MinhTri1911/following{/other_user}","gists_url":"https://api.github.com/users/MinhTri1911/gists{/gist_id}","starred_url":"https://api.github.com/users/MinhTri1911/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MinhTri1911/subscriptions","organizations_url":"https://api.github.com/users/MinhTri1911/orgs","repos_url":"https://api.github.com/users/MinhTri1911/repos","events_url":"https://api.github.com/users/MinhTri1911/events{/privacy}","received_events_url":"https://api.github.com/users/MinhTri1911/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MinhTri1911/campaign_01","description":null,"fork":true,"url":"https://api.github.com/repos/MinhTri1911/campaign_01","forks_url":"https://api.github.com/repos/MinhTri1911/campaign_01/forks","keys_url":"https://api.github.com/repos/MinhTri1911/campaign_01/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MinhTri1911/campaign_01/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MinhTri1911/campaign_01/teams","hooks_url":"https://api.github.com/repos/MinhTri1911/campaign_01/hooks","issue_events_url":"https://api.github.com/repos/MinhTri1911/campaign_01/issues/events{/number}","events_url":"https://api.github.com/repos/MinhTri1911/campaign_01/events","assignees_url":"https://api.github.com/repos/MinhTri1911/campaign_01/assignees{/user}","branches_url":"https://api.github.com/repos/MinhTri1911/campaign_01/branches{/branch}","tags_url":"https://api.github.com/repos/MinhTri1911/campaign_01/tags","blobs_url":"https://api.github.com/repos/MinhTri1911/campaign_01/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MinhTri1911/campaign_01/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MinhTri1911/campaign_01/git/refs{/sha}","trees_url":"https://api.github.com/repos/MinhTri1911/campaign_01/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MinhTri1911/campaign_01/statuses/{sha}","languages_url":"https://api.github.com/repos/MinhTri1911/campaign_01/languages","stargazers_url":"https://api.github.com/repos/MinhTri1911/campaign_01/stargazers","contributors_url":"https://api.github.com/repos/MinhTri1911/campaign_01/contributors","subscribers_url":"https://api.github.com/repos/MinhTri1911/campaign_01/subscribers","subscription_url":"https://api.github.com/repos/MinhTri1911/campaign_01/subscription","commits_url":"https://api.github.com/repos/MinhTri1911/campaign_01/commits{/sha}","git_commits_url":"https://api.github.com/repos/MinhTri1911/campaign_01/git/commits{/sha}","comments_url":"https://api.github.com/repos/MinhTri1911/campaign_01/comments{/number}","issue_comment_url":"https://api.github.com/repos/MinhTri1911/campaign_01/issues/comments{/number}","contents_url":"https://api.github.com/repos/MinhTri1911/campaign_01/contents/{+path}","compare_url":"https://api.github.com/repos/MinhTri1911/campaign_01/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MinhTri1911/campaign_01/merges","archive_url":"https://api.github.com/repos/MinhTri1911/campaign_01/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MinhTri1911/campaign_01/downloads","issues_url":"https://api.github.com/repos/MinhTri1911/campaign_01/issues{/number}","pulls_url":"https://api.github.com/repos/MinhTri1911/campaign_01/pulls{/number}","milestones_url":"https://api.github.com/repos/MinhTri1911/campaign_01/milestones{/number}","notifications_url":"https://api.github.com/repos/MinhTri1911/campaign_01/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MinhTri1911/campaign_01/labels{/name}","releases_url":"https://api.github.com/repos/MinhTri1911/campaign_01/releases{/id}","deployments_url":"https://api.github.com/repos/MinhTri1911/campaign_01/deployments","created_at":"2017-05-08T07:20:13Z","updated_at":"2017-05-08T03:56:23Z","pushed_at":"2017-08-04T06:55:57Z","git_url":"git://github.com/MinhTri1911/campaign_01.git","ssh_url":"git@github.com:MinhTri1911/campaign_01.git","clone_url":"https://github.com/MinhTri1911/campaign_01.git","svn_url":"https://github.com/MinhTri1911/campaign_01","homepage":null,"size":11031,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_projects":true,"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":"561f147895e0b35d04d512190ddf31fd2ebdac92","user":{"login":"framgia","id":2322183,"avatar_url":"https://avatars3.githubusercontent.com/u/2322183?v=4","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":90584601,"name":"campaign_01","full_name":"framgia/campaign_01","owner":{"login":"framgia","id":2322183,"avatar_url":"https://avatars3.githubusercontent.com/u/2322183?v=4","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/campaign_01","description":null,"fork":false,"url":"https://api.github.com/repos/framgia/campaign_01","forks_url":"https://api.github.com/repos/framgia/campaign_01/forks","keys_url":"https://api.github.com/repos/framgia/campaign_01/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/campaign_01/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/campaign_01/teams","hooks_url":"https://api.github.com/repos/framgia/campaign_01/hooks","issue_events_url":"https://api.github.com/repos/framgia/campaign_01/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/campaign_01/events","assignees_url":"https://api.github.com/repos/framgia/campaign_01/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/campaign_01/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/campaign_01/tags","blobs_url":"https://api.github.com/repos/framgia/campaign_01/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/campaign_01/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/campaign_01/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/campaign_01/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/campaign_01/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/campaign_01/languages","stargazers_url":"https://api.github.com/repos/framgia/campaign_01/stargazers","contributors_url":"https://api.github.com/repos/framgia/campaign_01/contributors","subscribers_url":"https://api.github.com/repos/framgia/campaign_01/subscribers","subscription_url":"https://api.github.com/repos/framgia/campaign_01/subscription","commits_url":"https://api.github.com/repos/framgia/campaign_01/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/campaign_01/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/campaign_01/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/campaign_01/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/campaign_01/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/campaign_01/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/campaign_01/merges","archive_url":"https://api.github.com/repos/framgia/campaign_01/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/campaign_01/downloads","issues_url":"https://api.github.com/repos/framgia/campaign_01/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/campaign_01/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/campaign_01/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/campaign_01/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/campaign_01/labels{/name}","releases_url":"https://api.github.com/repos/framgia/campaign_01/releases{/id}","deployments_url":"https://api.github.com/repos/framgia/campaign_01/deployments","created_at":"2017-05-08T03:56:23Z","updated_at":"2017-05-24T08:32:21Z","pushed_at":"2017-08-04T08:22:13Z","git_url":"git://github.com/framgia/campaign_01.git","ssh_url":"git@github.com:framgia/campaign_01.git","clone_url":"https://github.com/framgia/campaign_01.git","svn_url":"https://github.com/framgia/campaign_01","homepage":null,"size":11029,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":5,"forks":8,"open_issues":5,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/campaign_01/pulls/112"},"html":{"href":"https://github.com/framgia/campaign_01/pull/112"},"issue":{"href":"https://api.github.com/repos/framgia/campaign_01/issues/112"},"comments":{"href":"https://api.github.com/repos/framgia/campaign_01/issues/112/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/campaign_01/pulls/112/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/campaign_01/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/campaign_01/pulls/112/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/campaign_01/statuses/a9c08b975ecb3620079ac7595d1d2744645b64e8"}}}}
{"actor":{"display_login":"phanngoc"}}