{"action":"created","comment":{"url":"https://api.github.com/repos/NAKKA-K/bookbok/pulls/comments/243150202","pull_request_review_id":186841274,"id":243150202,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MzE1MDIwMg==","diff_hunk":"@@ -89,6 +103,20 @@ public function store(Request $request, $userId)\n             // booksテーブルに挿入する\n             $new_book->save();\n         }\n+\n+        // 当該ユーザのuser_bookテーブルに同じ本がすでに登録されているかのチェック\n+        $is_userBook_exists = UserBook::where('book_id', $book->id)->where('user_id', $userId)->first();","path":"app/Http/Controllers/UserBookController.php","position":36,"original_position":36,"commit_id":"27cd285f1fff8a7bbd6a59f53318d0c884f01847","original_commit_id":"27cd285f1fff8a7bbd6a59f53318d0c884f01847","user":{"login":"NAKKA-K","id":22770924,"node_id":"MDQ6VXNlcjIyNzcwOTI0","avatar_url":"https://avatars2.githubusercontent.com/u/22770924?v=4","gravatar_id":"","url":"https://api.github.com/users/NAKKA-K","html_url":"https://github.com/NAKKA-K","followers_url":"https://api.github.com/users/NAKKA-K/followers","following_url":"https://api.github.com/users/NAKKA-K/following{/other_user}","gists_url":"https://api.github.com/users/NAKKA-K/gists{/gist_id}","starred_url":"https://api.github.com/users/NAKKA-K/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NAKKA-K/subscriptions","organizations_url":"https://api.github.com/users/NAKKA-K/orgs","repos_url":"https://api.github.com/users/NAKKA-K/repos","events_url":"https://api.github.com/users/NAKKA-K/events{/privacy}","received_events_url":"https://api.github.com/users/NAKKA-K/received_events","type":"User","site_admin":false},"body":"どうせなら全部authIdを使ってしまえばいいんじゃない？","created_at":"2018-12-20T03:56:25Z","updated_at":"2018-12-20T03:56:49Z","html_url":"https://github.com/NAKKA-K/bookbok/pull/296#discussion_r243150202","pull_request_url":"https://api.github.com/repos/NAKKA-K/bookbok/pulls/296","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/NAKKA-K/bookbok/pulls/comments/243150202"},"html":{"href":"https://github.com/NAKKA-K/bookbok/pull/296#discussion_r243150202"},"pull_request":{"href":"https://api.github.com/repos/NAKKA-K/bookbok/pulls/296"}},"in_reply_to_id":243150093},"pull_request":{"url":"https://api.github.com/repos/NAKKA-K/bookbok/pulls/296","id":240013857,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQwMDEzODU3","html_url":"https://github.com/NAKKA-K/bookbok/pull/296","diff_url":"https://github.com/NAKKA-K/bookbok/pull/296.diff","patch_url":"https://github.com/NAKKA-K/bookbok/pull/296.patch","issue_url":"https://api.github.com/repos/NAKKA-K/bookbok/issues/296","number":296,"state":"open","locked":false,"title":"同じ本を本棚に登録しようとしたときの例外処理#259","user":{"login":"sugino0708","id":29668738,"node_id":"MDQ6VXNlcjI5NjY4NzM4","avatar_url":"https://avatars3.githubusercontent.com/u/29668738?v=4","gravatar_id":"","url":"https://api.github.com/users/sugino0708","html_url":"https://github.com/sugino0708","followers_url":"https://api.github.com/users/sugino0708/followers","following_url":"https://api.github.com/users/sugino0708/following{/other_user}","gists_url":"https://api.github.com/users/sugino0708/gists{/gist_id}","starred_url":"https://api.github.com/users/sugino0708/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sugino0708/subscriptions","organizations_url":"https://api.github.com/users/sugino0708/orgs","repos_url":"https://api.github.com/users/sugino0708/repos","events_url":"https://api.github.com/users/sugino0708/events{/privacy}","received_events_url":"https://api.github.com/users/sugino0708/received_events","type":"User","site_admin":false},"body":"connect to #259 \r\nclose #259 \r\n\r\n# 概要\r\n同じ本を登録しようとしたときにサーバ生成のエラーが自動的に返っていたので、それを処理しやすい形で返すようにした。\r\n\r\n# 主な変更点\r\n- 同じ本を本棚に登録しようとしたときのハンドリング\r\n- 違うユーザの本棚に本を登録しようとしたときのハンドリング\r\n\r\n# 成功時のレスポンス\r\n![default](https://user-images.githubusercontent.com/29668738/50255711-56a66000-0436-11e9-95f4-6960bf84e70d.PNG)\r\n\r\n# 同じ本を登録しようとしたときのレスポンス\r\n![400](https://user-images.githubusercontent.com/29668738/50255725-68880300-0436-11e9-9d08-e82dc6ea027b.PNG)\r\n\r\n# 異なるユーザの本棚に登録しようとしたときのレスポンス\r\n![403](https://user-images.githubusercontent.com/29668738/50255738-78074c00-0436-11e9-96d7-5c71c644193d.PNG)\r\n\r\n\r\n\r\n","created_at":"2018-12-20T00:10:22Z","updated_at":"2018-12-20T03:56:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e534a74aed7be04e702b3373f6108a415dd66314","assignee":{"login":"sugino0708","id":29668738,"node_id":"MDQ6VXNlcjI5NjY4NzM4","avatar_url":"https://avatars3.githubusercontent.com/u/29668738?v=4","gravatar_id":"","url":"https://api.github.com/users/sugino0708","html_url":"https://github.com/sugino0708","followers_url":"https://api.github.com/users/sugino0708/followers","following_url":"https://api.github.com/users/sugino0708/following{/other_user}","gists_url":"https://api.github.com/users/sugino0708/gists{/gist_id}","starred_url":"https://api.github.com/users/sugino0708/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sugino0708/subscriptions","organizations_url":"https://api.github.com/users/sugino0708/orgs","repos_url":"https://api.github.com/users/sugino0708/repos","events_url":"https://api.github.com/users/sugino0708/events{/privacy}","received_events_url":"https://api.github.com/users/sugino0708/received_events","type":"User","site_admin":false},"assignees":[{"login":"sugino0708","id":29668738,"node_id":"MDQ6VXNlcjI5NjY4NzM4","avatar_url":"https://avatars3.githubusercontent.com/u/29668738?v=4","gravatar_id":"","url":"https://api.github.com/users/sugino0708","html_url":"https://github.com/sugino0708","followers_url":"https://api.github.com/users/sugino0708/followers","following_url":"https://api.github.com/users/sugino0708/following{/other_user}","gists_url":"https://api.github.com/users/sugino0708/gists{/gist_id}","starred_url":"https://api.github.com/users/sugino0708/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sugino0708/subscriptions","organizations_url":"https://api.github.com/users/sugino0708/orgs","repos_url":"https://api.github.com/users/sugino0708/repos","events_url":"https://api.github.com/users/sugino0708/events{/privacy}","received_events_url":"https://api.github.com/users/sugino0708/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"kento-oka","id":30544668,"node_id":"MDQ6VXNlcjMwNTQ0NjY4","avatar_url":"https://avatars0.githubusercontent.com/u/30544668?v=4","gravatar_id":"","url":"https://api.github.com/users/kento-oka","html_url":"https://github.com/kento-oka","followers_url":"https://api.github.com/users/kento-oka/followers","following_url":"https://api.github.com/users/kento-oka/following{/other_user}","gists_url":"https://api.github.com/users/kento-oka/gists{/gist_id}","starred_url":"https://api.github.com/users/kento-oka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kento-oka/subscriptions","organizations_url":"https://api.github.com/users/kento-oka/orgs","repos_url":"https://api.github.com/users/kento-oka/repos","events_url":"https://api.github.com/users/kento-oka/events{/privacy}","received_events_url":"https://api.github.com/users/kento-oka/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":1100201489,"node_id":"MDU6TGFiZWwxMTAwMjAxNDg5","url":"https://api.github.com/repos/NAKKA-K/bookbok/labels/Backend","name":"Backend","color":"6dc4f9","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/NAKKA-K/bookbok/pulls/296/commits","review_comments_url":"https://api.github.com/repos/NAKKA-K/bookbok/pulls/296/comments","review_comment_url":"https://api.github.com/repos/NAKKA-K/bookbok/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NAKKA-K/bookbok/issues/296/comments","statuses_url":"https://api.github.com/repos/NAKKA-K/bookbok/statuses/27cd285f1fff8a7bbd6a59f53318d0c884f01847","head":{"label":"NAKKA-K:同じ本を本棚に登録しようとしたときの例外処理#259","ref":"同じ本を本棚に登録しようとしたときの例外処理#259","sha":"27cd285f1fff8a7bbd6a59f53318d0c884f01847","user":{"login":"NAKKA-K","id":22770924,"node_id":"MDQ6VXNlcjIyNzcwOTI0","avatar_url":"https://avatars2.githubusercontent.com/u/22770924?v=4","gravatar_id":"","url":"https://api.github.com/users/NAKKA-K","html_url":"https://github.com/NAKKA-K","followers_url":"https://api.github.com/users/NAKKA-K/followers","following_url":"https://api.github.com/users/NAKKA-K/following{/other_user}","gists_url":"https://api.github.com/users/NAKKA-K/gists{/gist_id}","starred_url":"https://api.github.com/users/NAKKA-K/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NAKKA-K/subscriptions","organizations_url":"https://api.github.com/users/NAKKA-K/orgs","repos_url":"https://api.github.com/users/NAKKA-K/repos","events_url":"https://api.github.com/users/NAKKA-K/events{/privacy}","received_events_url":"https://api.github.com/users/NAKKA-K/received_events","type":"User","site_admin":false},"repo":{"id":154164586,"node_id":"MDEwOlJlcG9zaXRvcnkxNTQxNjQ1ODY=","name":"bookbok","full_name":"NAKKA-K/bookbok","private":false,"owner":{"login":"NAKKA-K","id":22770924,"node_id":"MDQ6VXNlcjIyNzcwOTI0","avatar_url":"https://avatars2.githubusercontent.com/u/22770924?v=4","gravatar_id":"","url":"https://api.github.com/users/NAKKA-K","html_url":"https://github.com/NAKKA-K","followers_url":"https://api.github.com/users/NAKKA-K/followers","following_url":"https://api.github.com/users/NAKKA-K/following{/other_user}","gists_url":"https://api.github.com/users/NAKKA-K/gists{/gist_id}","starred_url":"https://api.github.com/users/NAKKA-K/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NAKKA-K/subscriptions","organizations_url":"https://api.github.com/users/NAKKA-K/orgs","repos_url":"https://api.github.com/users/NAKKA-K/repos","events_url":"https://api.github.com/users/NAKKA-K/events{/privacy}","received_events_url":"https://api.github.com/users/NAKKA-K/received_events","type":"User","site_admin":false},"html_url":"https://github.com/NAKKA-K/bookbok","description":null,"fork":false,"url":"https://api.github.com/repos/NAKKA-K/bookbok","forks_url":"https://api.github.com/repos/NAKKA-K/bookbok/forks","keys_url":"https://api.github.com/repos/NAKKA-K/bookbok/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NAKKA-K/bookbok/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NAKKA-K/bookbok/teams","hooks_url":"https://api.github.com/repos/NAKKA-K/bookbok/hooks","issue_events_url":"https://api.github.com/repos/NAKKA-K/bookbok/issues/events{/number}","events_url":"https://api.github.com/repos/NAKKA-K/bookbok/events","assignees_url":"https://api.github.com/repos/NAKKA-K/bookbok/assignees{/user}","branches_url":"https://api.github.com/repos/NAKKA-K/bookbok/branches{/branch}","tags_url":"https://api.github.com/repos/NAKKA-K/bookbok/tags","blobs_url":"https://api.github.com/repos/NAKKA-K/bookbok/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NAKKA-K/bookbok/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NAKKA-K/bookbok/git/refs{/sha}","trees_url":"https://api.github.com/repos/NAKKA-K/bookbok/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NAKKA-K/bookbok/statuses/{sha}","languages_url":"https://api.github.com/repos/NAKKA-K/bookbok/languages","stargazers_url":"https://api.github.com/repos/NAKKA-K/bookbok/stargazers","contributors_url":"https://api.github.com/repos/NAKKA-K/bookbok/contributors","subscribers_url":"https://api.github.com/repos/NAKKA-K/bookbok/subscribers","subscription_url":"https://api.github.com/repos/NAKKA-K/bookbok/subscription","commits_url":"https://api.github.com/repos/NAKKA-K/bookbok/commits{/sha}","git_commits_url":"https://api.github.com/repos/NAKKA-K/bookbok/git/commits{/sha}","comments_url":"https://api.github.com/repos/NAKKA-K/bookbok/comments{/number}","issue_comment_url":"https://api.github.com/repos/NAKKA-K/bookbok/issues/comments{/number}","contents_url":"https://api.github.com/repos/NAKKA-K/bookbok/contents/{+path}","compare_url":"https://api.github.com/repos/NAKKA-K/bookbok/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NAKKA-K/bookbok/merges","archive_url":"https://api.github.com/repos/NAKKA-K/bookbok/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NAKKA-K/bookbok/downloads","issues_url":"https://api.github.com/repos/NAKKA-K/bookbok/issues{/number}","pulls_url":"https://api.github.com/repos/NAKKA-K/bookbok/pulls{/number}","milestones_url":"https://api.github.com/repos/NAKKA-K/bookbok/milestones{/number}","notifications_url":"https://api.github.com/repos/NAKKA-K/bookbok/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NAKKA-K/bookbok/labels{/name}","releases_url":"https://api.github.com/repos/NAKKA-K/bookbok/releases{/id}","deployments_url":"https://api.github.com/repos/NAKKA-K/bookbok/deployments","created_at":"2018-10-22T15:07:02Z","updated_at":"2018-12-19T17:57:33Z","pushed_at":"2018-12-20T01:36:32Z","git_url":"git://github.com/NAKKA-K/bookbok.git","ssh_url":"git@github.com:NAKKA-K/bookbok.git","clone_url":"https://github.com/NAKKA-K/bookbok.git","svn_url":"https://github.com/NAKKA-K/bookbok","homepage":null,"size":1701,"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":46,"license":null,"forks":0,"open_issues":46,"watchers":0,"default_branch":"develop"}},"base":{"label":"NAKKA-K:develop","ref":"develop","sha":"93acafeddf4030473291569126adc80133132700","user":{"login":"NAKKA-K","id":22770924,"node_id":"MDQ6VXNlcjIyNzcwOTI0","avatar_url":"https://avatars2.githubusercontent.com/u/22770924?v=4","gravatar_id":"","url":"https://api.github.com/users/NAKKA-K","html_url":"https://github.com/NAKKA-K","followers_url":"https://api.github.com/users/NAKKA-K/followers","following_url":"https://api.github.com/users/NAKKA-K/following{/other_user}","gists_url":"https://api.github.com/users/NAKKA-K/gists{/gist_id}","starred_url":"https://api.github.com/users/NAKKA-K/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NAKKA-K/subscriptions","organizations_url":"https://api.github.com/users/NAKKA-K/orgs","repos_url":"https://api.github.com/users/NAKKA-K/repos","events_url":"https://api.github.com/users/NAKKA-K/events{/privacy}","received_events_url":"https://api.github.com/users/NAKKA-K/received_events","type":"User","site_admin":false},"repo":{"id":154164586,"node_id":"MDEwOlJlcG9zaXRvcnkxNTQxNjQ1ODY=","name":"bookbok","full_name":"NAKKA-K/bookbok","private":false,"owner":{"login":"NAKKA-K","id":22770924,"node_id":"MDQ6VXNlcjIyNzcwOTI0","avatar_url":"https://avatars2.githubusercontent.com/u/22770924?v=4","gravatar_id":"","url":"https://api.github.com/users/NAKKA-K","html_url":"https://github.com/NAKKA-K","followers_url":"https://api.github.com/users/NAKKA-K/followers","following_url":"https://api.github.com/users/NAKKA-K/following{/other_user}","gists_url":"https://api.github.com/users/NAKKA-K/gists{/gist_id}","starred_url":"https://api.github.com/users/NAKKA-K/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NAKKA-K/subscriptions","organizations_url":"https://api.github.com/users/NAKKA-K/orgs","repos_url":"https://api.github.com/users/NAKKA-K/repos","events_url":"https://api.github.com/users/NAKKA-K/events{/privacy}","received_events_url":"https://api.github.com/users/NAKKA-K/received_events","type":"User","site_admin":false},"html_url":"https://github.com/NAKKA-K/bookbok","description":null,"fork":false,"url":"https://api.github.com/repos/NAKKA-K/bookbok","forks_url":"https://api.github.com/repos/NAKKA-K/bookbok/forks","keys_url":"https://api.github.com/repos/NAKKA-K/bookbok/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NAKKA-K/bookbok/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NAKKA-K/bookbok/teams","hooks_url":"https://api.github.com/repos/NAKKA-K/bookbok/hooks","issue_events_url":"https://api.github.com/repos/NAKKA-K/bookbok/issues/events{/number}","events_url":"https://api.github.com/repos/NAKKA-K/bookbok/events","assignees_url":"https://api.github.com/repos/NAKKA-K/bookbok/assignees{/user}","branches_url":"https://api.github.com/repos/NAKKA-K/bookbok/branches{/branch}","tags_url":"https://api.github.com/repos/NAKKA-K/bookbok/tags","blobs_url":"https://api.github.com/repos/NAKKA-K/bookbok/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NAKKA-K/bookbok/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NAKKA-K/bookbok/git/refs{/sha}","trees_url":"https://api.github.com/repos/NAKKA-K/bookbok/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NAKKA-K/bookbok/statuses/{sha}","languages_url":"https://api.github.com/repos/NAKKA-K/bookbok/languages","stargazers_url":"https://api.github.com/repos/NAKKA-K/bookbok/stargazers","contributors_url":"https://api.github.com/repos/NAKKA-K/bookbok/contributors","subscribers_url":"https://api.github.com/repos/NAKKA-K/bookbok/subscribers","subscription_url":"https://api.github.com/repos/NAKKA-K/bookbok/subscription","commits_url":"https://api.github.com/repos/NAKKA-K/bookbok/commits{/sha}","git_commits_url":"https://api.github.com/repos/NAKKA-K/bookbok/git/commits{/sha}","comments_url":"https://api.github.com/repos/NAKKA-K/bookbok/comments{/number}","issue_comment_url":"https://api.github.com/repos/NAKKA-K/bookbok/issues/comments{/number}","contents_url":"https://api.github.com/repos/NAKKA-K/bookbok/contents/{+path}","compare_url":"https://api.github.com/repos/NAKKA-K/bookbok/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NAKKA-K/bookbok/merges","archive_url":"https://api.github.com/repos/NAKKA-K/bookbok/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NAKKA-K/bookbok/downloads","issues_url":"https://api.github.com/repos/NAKKA-K/bookbok/issues{/number}","pulls_url":"https://api.github.com/repos/NAKKA-K/bookbok/pulls{/number}","milestones_url":"https://api.github.com/repos/NAKKA-K/bookbok/milestones{/number}","notifications_url":"https://api.github.com/repos/NAKKA-K/bookbok/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NAKKA-K/bookbok/labels{/name}","releases_url":"https://api.github.com/repos/NAKKA-K/bookbok/releases{/id}","deployments_url":"https://api.github.com/repos/NAKKA-K/bookbok/deployments","created_at":"2018-10-22T15:07:02Z","updated_at":"2018-12-19T17:57:33Z","pushed_at":"2018-12-20T01:36:32Z","git_url":"git://github.com/NAKKA-K/bookbok.git","ssh_url":"git@github.com:NAKKA-K/bookbok.git","clone_url":"https://github.com/NAKKA-K/bookbok.git","svn_url":"https://github.com/NAKKA-K/bookbok","homepage":null,"size":1701,"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":46,"license":null,"forks":0,"open_issues":46,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/NAKKA-K/bookbok/pulls/296"},"html":{"href":"https://github.com/NAKKA-K/bookbok/pull/296"},"issue":{"href":"https://api.github.com/repos/NAKKA-K/bookbok/issues/296"},"comments":{"href":"https://api.github.com/repos/NAKKA-K/bookbok/issues/296/comments"},"review_comments":{"href":"https://api.github.com/repos/NAKKA-K/bookbok/pulls/296/comments"},"review_comment":{"href":"https://api.github.com/repos/NAKKA-K/bookbok/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NAKKA-K/bookbok/pulls/296/commits"},"statuses":{"href":"https://api.github.com/repos/NAKKA-K/bookbok/statuses/27cd285f1fff8a7bbd6a59f53318d0c884f01847"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"NAKKA-K"}}