{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/votingsys_01/pulls/comments/102887002","pull_request_review_id":23656572,"id":102887002,"diff_hunk":"@@ -0,0 +1,42 @@\n+<?php\n+\n+namespace App\\RepositoriesApi;\n+\n+use App\\Models\\SocialAccount;\n+use App\\Models\\User;\n+use Laravel\\Socialite\\Contracts\\Provider;\n+use App\\RepositoriesApi\\Contracts\\SocialAccountRepositoryInterface;\n+\n+class SocialAccountRepositoryEloquent extends AbstractRepositoryEloquent implements SocialAccountRepositoryInterface\n+{\n+    public function __construct(SocialAccount $model)\n+    {\n+        parent::__construct($model);\n+    }\n+\n+    public function createOrGetUser(Provider $provider, $data)\n+    {\n+        $providerUser = $provider->userFromToken($data['token']);\n+        $account = SocialAccount::whereProvider($data['provider'])\n+            ->whereProviderUserId($providerUser->getId())\n+            ->first();\n+        if ($account) {\n+            return $account->user;\n+        }\n+        $account = new SocialAccount([\n+            'provider_user_id' => $providerUser->getId(),\n+            'provider' => $data['provider']\n+        ]);\n+        $user = User::whereEmail($providerUser->getEmail())->first();\n+        if (!$user) {\n+            $user = User::create([\n+                'email' => $providerUser->getEmail(),\n+                'name' => $providerUser->getName(),","path":"app/RepositoriesApi/SocialAccountRepositoryEloquent.php","position":34,"original_position":34,"commit_id":"28c54b956509140251398560f841b99001b05373","original_commit_id":"28c54b956509140251398560f841b99001b05373","user":{"login":"at-diephq","id":10395607,"avatar_url":"https://avatars.githubusercontent.com/u/10395607?v=3","gravatar_id":"","url":"https://api.github.com/users/at-diephq","html_url":"https://github.com/at-diephq","followers_url":"https://api.github.com/users/at-diephq/followers","following_url":"https://api.github.com/users/at-diephq/following{/other_user}","gists_url":"https://api.github.com/users/at-diephq/gists{/gist_id}","starred_url":"https://api.github.com/users/at-diephq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/at-diephq/subscriptions","organizations_url":"https://api.github.com/users/at-diephq/orgs","repos_url":"https://api.github.com/users/at-diephq/repos","events_url":"https://api.github.com/users/at-diephq/events{/privacy}","received_events_url":"https://api.github.com/users/at-diephq/received_events","type":"User","site_admin":false},"body":"em nên lưu luôn cái `avatar` lại nhé, để khi user login bằng web thì cũng có avatar luôn ","created_at":"2017-02-24T06:39:19Z","updated_at":"2017-02-24T06:39:46Z","html_url":"https://github.com/framgia/votingsys_01/pull/93#discussion_r102887002","pull_request_url":"https://api.github.com/repos/framgia/votingsys_01/pulls/93","_links":{"self":{"href":"https://api.github.com/repos/framgia/votingsys_01/pulls/comments/102887002"},"html":{"href":"https://github.com/framgia/votingsys_01/pull/93#discussion_r102887002"},"pull_request":{"href":"https://api.github.com/repos/framgia/votingsys_01/pulls/93"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/votingsys_01/pulls/93","id":106926906,"html_url":"https://github.com/framgia/votingsys_01/pull/93","diff_url":"https://github.com/framgia/votingsys_01/pull/93.diff","patch_url":"https://github.com/framgia/votingsys_01/pull/93.patch","issue_url":"https://api.github.com/repos/framgia/votingsys_01/issues/93","number":93,"state":"open","locked":false,"title":"api user login socialite","user":{"login":"phuocbv","id":15385475,"avatar_url":"https://avatars.githubusercontent.com/u/15385475?v=3","gravatar_id":"","url":"https://api.github.com/users/phuocbv","html_url":"https://github.com/phuocbv","followers_url":"https://api.github.com/users/phuocbv/followers","following_url":"https://api.github.com/users/phuocbv/following{/other_user}","gists_url":"https://api.github.com/users/phuocbv/gists{/gist_id}","starred_url":"https://api.github.com/users/phuocbv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phuocbv/subscriptions","organizations_url":"https://api.github.com/users/phuocbv/orgs","repos_url":"https://api.github.com/users/phuocbv/repos","events_url":"https://api.github.com/users/phuocbv/events{/privacy}","received_events_url":"https://api.github.com/users/phuocbv/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-02-20T01:24:50Z","updated_at":"2017-02-24T06:39:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a2cc61b8014954f280aef7fe1d2518f9cb147c68","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/framgia/votingsys_01/pulls/93/commits","review_comments_url":"https://api.github.com/repos/framgia/votingsys_01/pulls/93/comments","review_comment_url":"https://api.github.com/repos/framgia/votingsys_01/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/votingsys_01/issues/93/comments","statuses_url":"https://api.github.com/repos/framgia/votingsys_01/statuses/28c54b956509140251398560f841b99001b05373","head":{"label":"phuocbv:API_USER-LOGIN-SOCIALITE","ref":"API_USER-LOGIN-SOCIALITE","sha":"28c54b956509140251398560f841b99001b05373","user":{"login":"phuocbv","id":15385475,"avatar_url":"https://avatars.githubusercontent.com/u/15385475?v=3","gravatar_id":"","url":"https://api.github.com/users/phuocbv","html_url":"https://github.com/phuocbv","followers_url":"https://api.github.com/users/phuocbv/followers","following_url":"https://api.github.com/users/phuocbv/following{/other_user}","gists_url":"https://api.github.com/users/phuocbv/gists{/gist_id}","starred_url":"https://api.github.com/users/phuocbv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phuocbv/subscriptions","organizations_url":"https://api.github.com/users/phuocbv/orgs","repos_url":"https://api.github.com/users/phuocbv/repos","events_url":"https://api.github.com/users/phuocbv/events{/privacy}","received_events_url":"https://api.github.com/users/phuocbv/received_events","type":"User","site_admin":false},"repo":{"id":82031055,"name":"votingsys_01","full_name":"phuocbv/votingsys_01","owner":{"login":"phuocbv","id":15385475,"avatar_url":"https://avatars.githubusercontent.com/u/15385475?v=3","gravatar_id":"","url":"https://api.github.com/users/phuocbv","html_url":"https://github.com/phuocbv","followers_url":"https://api.github.com/users/phuocbv/followers","following_url":"https://api.github.com/users/phuocbv/following{/other_user}","gists_url":"https://api.github.com/users/phuocbv/gists{/gist_id}","starred_url":"https://api.github.com/users/phuocbv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phuocbv/subscriptions","organizations_url":"https://api.github.com/users/phuocbv/orgs","repos_url":"https://api.github.com/users/phuocbv/repos","events_url":"https://api.github.com/users/phuocbv/events{/privacy}","received_events_url":"https://api.github.com/users/phuocbv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/phuocbv/votingsys_01","description":"Framgia Edu DN - Training Project","fork":true,"url":"https://api.github.com/repos/phuocbv/votingsys_01","forks_url":"https://api.github.com/repos/phuocbv/votingsys_01/forks","keys_url":"https://api.github.com/repos/phuocbv/votingsys_01/keys{/key_id}","collaborators_url":"https://api.github.com/repos/phuocbv/votingsys_01/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/phuocbv/votingsys_01/teams","hooks_url":"https://api.github.com/repos/phuocbv/votingsys_01/hooks","issue_events_url":"https://api.github.com/repos/phuocbv/votingsys_01/issues/events{/number}","events_url":"https://api.github.com/repos/phuocbv/votingsys_01/events","assignees_url":"https://api.github.com/repos/phuocbv/votingsys_01/assignees{/user}","branches_url":"https://api.github.com/repos/phuocbv/votingsys_01/branches{/branch}","tags_url":"https://api.github.com/repos/phuocbv/votingsys_01/tags","blobs_url":"https://api.github.com/repos/phuocbv/votingsys_01/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/phuocbv/votingsys_01/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/phuocbv/votingsys_01/git/refs{/sha}","trees_url":"https://api.github.com/repos/phuocbv/votingsys_01/git/trees{/sha}","statuses_url":"https://api.github.com/repos/phuocbv/votingsys_01/statuses/{sha}","languages_url":"https://api.github.com/repos/phuocbv/votingsys_01/languages","stargazers_url":"https://api.github.com/repos/phuocbv/votingsys_01/stargazers","contributors_url":"https://api.github.com/repos/phuocbv/votingsys_01/contributors","subscribers_url":"https://api.github.com/repos/phuocbv/votingsys_01/subscribers","subscription_url":"https://api.github.com/repos/phuocbv/votingsys_01/subscription","commits_url":"https://api.github.com/repos/phuocbv/votingsys_01/commits{/sha}","git_commits_url":"https://api.github.com/repos/phuocbv/votingsys_01/git/commits{/sha}","comments_url":"https://api.github.com/repos/phuocbv/votingsys_01/comments{/number}","issue_comment_url":"https://api.github.com/repos/phuocbv/votingsys_01/issues/comments{/number}","contents_url":"https://api.github.com/repos/phuocbv/votingsys_01/contents/{+path}","compare_url":"https://api.github.com/repos/phuocbv/votingsys_01/compare/{base}...{head}","merges_url":"https://api.github.com/repos/phuocbv/votingsys_01/merges","archive_url":"https://api.github.com/repos/phuocbv/votingsys_01/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/phuocbv/votingsys_01/downloads","issues_url":"https://api.github.com/repos/phuocbv/votingsys_01/issues{/number}","pulls_url":"https://api.github.com/repos/phuocbv/votingsys_01/pulls{/number}","milestones_url":"https://api.github.com/repos/phuocbv/votingsys_01/milestones{/number}","notifications_url":"https://api.github.com/repos/phuocbv/votingsys_01/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/phuocbv/votingsys_01/labels{/name}","releases_url":"https://api.github.com/repos/phuocbv/votingsys_01/releases{/id}","deployments_url":"https://api.github.com/repos/phuocbv/votingsys_01/deployments","created_at":"2017-02-15T07:11:08Z","updated_at":"2017-01-16T04:41:41Z","pushed_at":"2017-02-24T06:17:44Z","git_url":"git://github.com/phuocbv/votingsys_01.git","ssh_url":"git@github.com:phuocbv/votingsys_01.git","clone_url":"https://github.com/phuocbv/votingsys_01.git","svn_url":"https://github.com/phuocbv/votingsys_01","homepage":null,"size":6563,"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":"5532a4a4658529c39696e4693d342c70ccd3a50b","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":70871698,"name":"votingsys_01","full_name":"framgia/votingsys_01","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/votingsys_01","description":"Framgia Edu DN - Training Project","fork":false,"url":"https://api.github.com/repos/framgia/votingsys_01","forks_url":"https://api.github.com/repos/framgia/votingsys_01/forks","keys_url":"https://api.github.com/repos/framgia/votingsys_01/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/votingsys_01/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/votingsys_01/teams","hooks_url":"https://api.github.com/repos/framgia/votingsys_01/hooks","issue_events_url":"https://api.github.com/repos/framgia/votingsys_01/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/votingsys_01/events","assignees_url":"https://api.github.com/repos/framgia/votingsys_01/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/votingsys_01/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/votingsys_01/tags","blobs_url":"https://api.github.com/repos/framgia/votingsys_01/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/votingsys_01/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/votingsys_01/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/votingsys_01/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/votingsys_01/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/votingsys_01/languages","stargazers_url":"https://api.github.com/repos/framgia/votingsys_01/stargazers","contributors_url":"https://api.github.com/repos/framgia/votingsys_01/contributors","subscribers_url":"https://api.github.com/repos/framgia/votingsys_01/subscribers","subscription_url":"https://api.github.com/repos/framgia/votingsys_01/subscription","commits_url":"https://api.github.com/repos/framgia/votingsys_01/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/votingsys_01/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/votingsys_01/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/votingsys_01/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/votingsys_01/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/votingsys_01/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/votingsys_01/merges","archive_url":"https://api.github.com/repos/framgia/votingsys_01/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/votingsys_01/downloads","issues_url":"https://api.github.com/repos/framgia/votingsys_01/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/votingsys_01/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/votingsys_01/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/votingsys_01/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/votingsys_01/labels{/name}","releases_url":"https://api.github.com/repos/framgia/votingsys_01/releases{/id}","deployments_url":"https://api.github.com/repos/framgia/votingsys_01/deployments","created_at":"2016-10-14T03:44:09Z","updated_at":"2017-01-16T04:41:41Z","pushed_at":"2017-02-24T06:17:45Z","git_url":"git://github.com/framgia/votingsys_01.git","ssh_url":"git@github.com:framgia/votingsys_01.git","clone_url":"https://github.com/framgia/votingsys_01.git","svn_url":"https://github.com/framgia/votingsys_01","homepage":null,"size":6551,"stargazers_count":1,"watchers_count":1,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":4,"forks":7,"open_issues":4,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/votingsys_01/pulls/93"},"html":{"href":"https://github.com/framgia/votingsys_01/pull/93"},"issue":{"href":"https://api.github.com/repos/framgia/votingsys_01/issues/93"},"comments":{"href":"https://api.github.com/repos/framgia/votingsys_01/issues/93/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/votingsys_01/pulls/93/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/votingsys_01/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/votingsys_01/pulls/93/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/votingsys_01/statuses/28c54b956509140251398560f841b99001b05373"}}}}
{"actor":{"display_login":"at-diephq"}}