{"action":"created","comment":{"url":"https://api.github.com/repos/andela/suyabay/pulls/comments/50393457","id":50393457,"diff_hunk":"@@ -0,0 +1,56 @@\n+<?php\n+\n+namespace Suyabay\\Http\\Repository;\n+\n+use DB;\n+use Auth;\n+use Suyabay\\Like;\n+\n+class LikeRepository\n+{\n+\n+\t/*Find like where*/\n+\tpublic function findLikeWhere($field, $value)\n+\t{\n+\t\treturn Like::where($field, $value);\n+\t}\n+\n+\t/*Fine and Delete Episode liked by a user*/\n+\tpublic function findLikeByUserOnEpisode($user_id, $episode_id)\n+\t{\n+\t\t  return DB::table('likes')\n+                ->where('user_id', $user_id)\n+                ->where('episode_id', $episode_id)\n+                ->delete();\n+\t}\n+\n+    public function insertIntoLikesTable($userid, $episodeid)\n+\t{\n+\t\tLike::insert(['user_id' => $userid, 'episode_id' => $episodeid]);\n+\t}\n+\n+\tpublic function checkLikeStatusForUserOnEpisode($likes)\n+\t{\n+\t\t$is_like_episode = false;\n+\n+\t\tforeach ($likes as $like) {\n+\n+\t\t\tif($like->user_id == Auth::user()->id) {\n+\t\t\t\t$is_like_episode = true;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\n+\t\tif ($is_like_episode) {\n+\n+\t\t\t$status = \"dislike\";\n+\t\t}\n+\t\telse\n+\t\t{\n+\t\t\t$status = \"like\";\n+\t\t}\n+\n+\t\treturn $status;\n+\t}","path":"app/Http/Repository/LikeRepository.php","position":54,"original_position":54,"commit_id":"f5fa6a1ecb41b3e349f17cf8f04fe013efa18f7e","original_commit_id":"f5fa6a1ecb41b3e349f17cf8f04fe013efa18f7e","user":{"login":"Nitpick-CI","id":12626182,"avatar_url":"https://avatars.githubusercontent.com/u/12626182?v=3","gravatar_id":"","url":"https://api.github.com/users/Nitpick-CI","html_url":"https://github.com/Nitpick-CI","followers_url":"https://api.github.com/users/Nitpick-CI/followers","following_url":"https://api.github.com/users/Nitpick-CI/following{/other_user}","gists_url":"https://api.github.com/users/Nitpick-CI/gists{/gist_id}","starred_url":"https://api.github.com/users/Nitpick-CI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nitpick-CI/subscriptions","organizations_url":"https://api.github.com/users/Nitpick-CI/orgs","repos_url":"https://api.github.com/users/Nitpick-CI/repos","events_url":"https://api.github.com/users/Nitpick-CI/events{/privacy}","received_events_url":"https://api.github.com/users/Nitpick-CI/received_events","type":"User","site_admin":false},"body":"Spaces must be used to indent lines; tabs are not allowed","created_at":"2016-01-21T12:13:44Z","updated_at":"2016-01-21T12:13:44Z","html_url":"https://github.com/andela/suyabay/pull/134#discussion_r50393457","pull_request_url":"https://api.github.com/repos/andela/suyabay/pulls/134","_links":{"self":{"href":"https://api.github.com/repos/andela/suyabay/pulls/comments/50393457"},"html":{"href":"https://github.com/andela/suyabay/pull/134#discussion_r50393457"},"pull_request":{"href":"https://api.github.com/repos/andela/suyabay/pulls/134"}}},"pull_request":{"url":"https://api.github.com/repos/andela/suyabay/pulls/134","id":56739219,"html_url":"https://github.com/andela/suyabay/pull/134","diff_url":"https://github.com/andela/suyabay/pull/134.diff","patch_url":"https://github.com/andela/suyabay/pull/134.patch","issue_url":"https://api.github.com/repos/andela/suyabay/issues/134","number":134,"state":"open","locked":false,"title":"Favorite episode","user":{"login":"andela-eosuagwu","id":13197724,"avatar_url":"https://avatars.githubusercontent.com/u/13197724?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-eosuagwu","html_url":"https://github.com/andela-eosuagwu","followers_url":"https://api.github.com/users/andela-eosuagwu/followers","following_url":"https://api.github.com/users/andela-eosuagwu/following{/other_user}","gists_url":"https://api.github.com/users/andela-eosuagwu/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-eosuagwu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-eosuagwu/subscriptions","organizations_url":"https://api.github.com/users/andela-eosuagwu/orgs","repos_url":"https://api.github.com/users/andela-eosuagwu/repos","events_url":"https://api.github.com/users/andela-eosuagwu/events{/privacy}","received_events_url":"https://api.github.com/users/andela-eosuagwu/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-01-21T11:54:09Z","updated_at":"2016-01-21T12:13:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1ba758f4b0dc5931df6b38aa799ac3f52e62736a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/andela/suyabay/pulls/134/commits","review_comments_url":"https://api.github.com/repos/andela/suyabay/pulls/134/comments","review_comment_url":"https://api.github.com/repos/andela/suyabay/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andela/suyabay/issues/134/comments","statuses_url":"https://api.github.com/repos/andela/suyabay/statuses/f5fa6a1ecb41b3e349f17cf8f04fe013efa18f7e","head":{"label":"andela:FavoriteEpisode","ref":"FavoriteEpisode","sha":"f5fa6a1ecb41b3e349f17cf8f04fe013efa18f7e","user":{"login":"andela","id":4100206,"avatar_url":"https://avatars.githubusercontent.com/u/4100206?v=3","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"repo":{"id":41855319,"name":"suyabay","full_name":"andela/suyabay","owner":{"login":"andela","id":4100206,"avatar_url":"https://avatars.githubusercontent.com/u/4100206?v=3","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/andela/suyabay","description":"Awesome Podcast FM Network for Suya Lovers","fork":false,"url":"https://api.github.com/repos/andela/suyabay","forks_url":"https://api.github.com/repos/andela/suyabay/forks","keys_url":"https://api.github.com/repos/andela/suyabay/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela/suyabay/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela/suyabay/teams","hooks_url":"https://api.github.com/repos/andela/suyabay/hooks","issue_events_url":"https://api.github.com/repos/andela/suyabay/issues/events{/number}","events_url":"https://api.github.com/repos/andela/suyabay/events","assignees_url":"https://api.github.com/repos/andela/suyabay/assignees{/user}","branches_url":"https://api.github.com/repos/andela/suyabay/branches{/branch}","tags_url":"https://api.github.com/repos/andela/suyabay/tags","blobs_url":"https://api.github.com/repos/andela/suyabay/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela/suyabay/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela/suyabay/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela/suyabay/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela/suyabay/statuses/{sha}","languages_url":"https://api.github.com/repos/andela/suyabay/languages","stargazers_url":"https://api.github.com/repos/andela/suyabay/stargazers","contributors_url":"https://api.github.com/repos/andela/suyabay/contributors","subscribers_url":"https://api.github.com/repos/andela/suyabay/subscribers","subscription_url":"https://api.github.com/repos/andela/suyabay/subscription","commits_url":"https://api.github.com/repos/andela/suyabay/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela/suyabay/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela/suyabay/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela/suyabay/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela/suyabay/contents/{+path}","compare_url":"https://api.github.com/repos/andela/suyabay/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela/suyabay/merges","archive_url":"https://api.github.com/repos/andela/suyabay/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela/suyabay/downloads","issues_url":"https://api.github.com/repos/andela/suyabay/issues{/number}","pulls_url":"https://api.github.com/repos/andela/suyabay/pulls{/number}","milestones_url":"https://api.github.com/repos/andela/suyabay/milestones{/number}","notifications_url":"https://api.github.com/repos/andela/suyabay/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela/suyabay/labels{/name}","releases_url":"https://api.github.com/repos/andela/suyabay/releases{/id}","created_at":"2015-09-03T11:00:56Z","updated_at":"2016-01-12T07:54:35Z","pushed_at":"2016-01-21T12:13:36Z","git_url":"git://github.com/andela/suyabay.git","ssh_url":"git@github.com:andela/suyabay.git","clone_url":"https://github.com/andela/suyabay.git","svn_url":"https://github.com/andela/suyabay","homepage":"https://suyabay-staging.herokuapp.com","size":16097,"stargazers_count":4,"watchers_count":4,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":11,"forks":3,"open_issues":11,"watchers":4,"default_branch":"staging"}},"base":{"label":"andela:staging","ref":"staging","sha":"e27b2f9a504b9d082872d29497a8725e9e0623fe","user":{"login":"andela","id":4100206,"avatar_url":"https://avatars.githubusercontent.com/u/4100206?v=3","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"repo":{"id":41855319,"name":"suyabay","full_name":"andela/suyabay","owner":{"login":"andela","id":4100206,"avatar_url":"https://avatars.githubusercontent.com/u/4100206?v=3","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/andela/suyabay","description":"Awesome Podcast FM Network for Suya Lovers","fork":false,"url":"https://api.github.com/repos/andela/suyabay","forks_url":"https://api.github.com/repos/andela/suyabay/forks","keys_url":"https://api.github.com/repos/andela/suyabay/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela/suyabay/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela/suyabay/teams","hooks_url":"https://api.github.com/repos/andela/suyabay/hooks","issue_events_url":"https://api.github.com/repos/andela/suyabay/issues/events{/number}","events_url":"https://api.github.com/repos/andela/suyabay/events","assignees_url":"https://api.github.com/repos/andela/suyabay/assignees{/user}","branches_url":"https://api.github.com/repos/andela/suyabay/branches{/branch}","tags_url":"https://api.github.com/repos/andela/suyabay/tags","blobs_url":"https://api.github.com/repos/andela/suyabay/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela/suyabay/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela/suyabay/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela/suyabay/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela/suyabay/statuses/{sha}","languages_url":"https://api.github.com/repos/andela/suyabay/languages","stargazers_url":"https://api.github.com/repos/andela/suyabay/stargazers","contributors_url":"https://api.github.com/repos/andela/suyabay/contributors","subscribers_url":"https://api.github.com/repos/andela/suyabay/subscribers","subscription_url":"https://api.github.com/repos/andela/suyabay/subscription","commits_url":"https://api.github.com/repos/andela/suyabay/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela/suyabay/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela/suyabay/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela/suyabay/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela/suyabay/contents/{+path}","compare_url":"https://api.github.com/repos/andela/suyabay/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela/suyabay/merges","archive_url":"https://api.github.com/repos/andela/suyabay/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela/suyabay/downloads","issues_url":"https://api.github.com/repos/andela/suyabay/issues{/number}","pulls_url":"https://api.github.com/repos/andela/suyabay/pulls{/number}","milestones_url":"https://api.github.com/repos/andela/suyabay/milestones{/number}","notifications_url":"https://api.github.com/repos/andela/suyabay/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela/suyabay/labels{/name}","releases_url":"https://api.github.com/repos/andela/suyabay/releases{/id}","created_at":"2015-09-03T11:00:56Z","updated_at":"2016-01-12T07:54:35Z","pushed_at":"2016-01-21T12:13:36Z","git_url":"git://github.com/andela/suyabay.git","ssh_url":"git@github.com:andela/suyabay.git","clone_url":"https://github.com/andela/suyabay.git","svn_url":"https://github.com/andela/suyabay","homepage":"https://suyabay-staging.herokuapp.com","size":16097,"stargazers_count":4,"watchers_count":4,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":11,"forks":3,"open_issues":11,"watchers":4,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/andela/suyabay/pulls/134"},"html":{"href":"https://github.com/andela/suyabay/pull/134"},"issue":{"href":"https://api.github.com/repos/andela/suyabay/issues/134"},"comments":{"href":"https://api.github.com/repos/andela/suyabay/issues/134/comments"},"review_comments":{"href":"https://api.github.com/repos/andela/suyabay/pulls/134/comments"},"review_comment":{"href":"https://api.github.com/repos/andela/suyabay/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andela/suyabay/pulls/134/commits"},"statuses":{"href":"https://api.github.com/repos/andela/suyabay/statuses/f5fa6a1ecb41b3e349f17cf8f04fe013efa18f7e"}}}}