{"action":"created","comment":{"url":"https://api.github.com/repos/andela/suyabay/pulls/comments/51028621","id":51028621,"diff_hunk":"@@ -123,35 +153,96 @@ public function update(Request $request)\n \n     /**\n      * Remove the specified resource from storage.\n-     *\n      * @param  int  $id\n      */\n     public function destroy($id)\n     {\n-        $deleteChannel = $this->channelRepository->getChannelByField('id', $id)->delete();\n+        try {\n+            $this->channel->deleteChannel($id);\n+            Episode::where('channel_id', $id)->update(['flag' => 1]);\n \n-        if ($deleteChannel) {\n             $this->response =\n             [\n-                \"message\"       => \"Channel deleted successfully\",\n-                \"status_code\"   => 200\n+                'message'     => 'Channel deleted Successfully',\n+                'status_code' => 200\n             ];\n-        } else {\n+        } catch (QueryException $e) {\n+\n             $this->response =\n             [\n-                \"message\"       => \"Unable to delete channel\",\n-                \"status_code\"   => 400\n+                'message'     => $e->getMessage(),\n+                'status_code' => 400\n             ];\n         }\n \n         return $this->response;\n     }\n \n+    /**\n+     * restore soft deleted channel\n+     * @param int $id\n+     */\n+    public function restore($id)\n+    {\n+        $this->channel->restoreChannel($id);\n+        Episode::where('channel_id', $id)->update(['flag' => 0]);\n+\n+        return redirect()->back();\n+    }\n+\n+    /**\n+     * Return selected channel with all episodes under it\n+     * @param int $id\n+     * @return \\Illuminate\\Http\\Response\n+     */\n     public function showChannel($id)\n     {\n         $channel = Channel::find($id);\n         $episodes = Episode::where('channel_id', '=', $id)->get();\n-\n+        \n         return view('dashboard.pages.view_channel')->with('channel', $channel)->with('episodes', $episodes);\n     }\n+\n+    /**\n+     * return view to swap episodes to another channel\n+     * @param int $id\n+     * @return \n+     */\n+    public function swap($id)\n+    {\n+        $channels   = Channel::where('id', '!=', $id)->get();\n+        $channel    = Channel::where('id', $id)->first();\n+\n+        return view('dashboard.pages.swap_episodes', compact('channels', 'id', 'channel'));\n+    }\n+\n+    /**\n+     * move episodes from source to destination\n+     * @param  [type] $id [description]\n+     * @return [type]     [description]\n+     */ \n+    \n+    public function processSwap(Request $request)\n+    {\n+        try {\n+            $swap = Episode::where('channel_id', $request->channel_id)->update(['channel_id' => $request->new_channel_id]);\n+            $this->channel->deleteChannel($request->channel_id);\n+            Episode::where('channel_id', $request->channel_id)->update(['flag' => 1]);\n+\n+            $this->response =\n+            [\n+                'message'     => 'Episodes swapped and Channel deleted Successfully!',\n+                'status_code' => 200\n+            ];\n+        } catch (QueryException $e) {","path":"app/Http/Controllers/ChannelController.php","position":218,"original_position":218,"commit_id":"13fc636c4c94fc329afda7f7200d1922633d0adb","original_commit_id":"13fc636c4c94fc329afda7f7200d1922633d0adb","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":"Expected 1 newline after opening brace; 2 found","created_at":"2016-01-27T18:40:35Z","updated_at":"2016-01-27T18:40:35Z","html_url":"https://github.com/andela/suyabay/pull/143#discussion_r51028621","pull_request_url":"https://api.github.com/repos/andela/suyabay/pulls/143","_links":{"self":{"href":"https://api.github.com/repos/andela/suyabay/pulls/comments/51028621"},"html":{"href":"https://github.com/andela/suyabay/pull/143#discussion_r51028621"},"pull_request":{"href":"https://api.github.com/repos/andela/suyabay/pulls/143"}}},"pull_request":{"url":"https://api.github.com/repos/andela/suyabay/pulls/143","id":57401403,"html_url":"https://github.com/andela/suyabay/pull/143","diff_url":"https://github.com/andela/suyabay/pull/143.diff","patch_url":"https://github.com/andela/suyabay/pull/143.patch","issue_url":"https://api.github.com/repos/andela/suyabay/issues/143","number":143,"state":"open","locked":false,"title":"[Feature][#112126869] Implement Episodes Swapping","user":{"login":"andela-fokosun","id":7254731,"avatar_url":"https://avatars.githubusercontent.com/u/7254731?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-fokosun","html_url":"https://github.com/andela-fokosun","followers_url":"https://api.github.com/users/andela-fokosun/followers","following_url":"https://api.github.com/users/andela-fokosun/following{/other_user}","gists_url":"https://api.github.com/users/andela-fokosun/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-fokosun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-fokosun/subscriptions","organizations_url":"https://api.github.com/users/andela-fokosun/orgs","repos_url":"https://api.github.com/users/andela-fokosun/repos","events_url":"https://api.github.com/users/andela-fokosun/events{/privacy}","received_events_url":"https://api.github.com/users/andela-fokosun/received_events","type":"User","site_admin":false},"body":"1. Implement soft delete on channels\r\n2. Implement Episodes swap for channels to be deleted\r\n3. Fix issues with Creating new episodes\r\n4. implement updating of Episodes\r\n5. Implement Deleting of Episodes\r\n6. Create FilesRepository (handles files upload to the cloud)","created_at":"2016-01-27T18:24:58Z","updated_at":"2016-01-27T18:40:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"541fff76f3ed1bf986db1a1d52639f5d25b18b99","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/andela/suyabay/pulls/143/commits","review_comments_url":"https://api.github.com/repos/andela/suyabay/pulls/143/comments","review_comment_url":"https://api.github.com/repos/andela/suyabay/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andela/suyabay/issues/143/comments","statuses_url":"https://api.github.com/repos/andela/suyabay/statuses/13fc636c4c94fc329afda7f7200d1922633d0adb","head":{"label":"andela:ResponsiveChannelsView","ref":"ResponsiveChannelsView","sha":"13fc636c4c94fc329afda7f7200d1922633d0adb","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}","deployments_url":"https://api.github.com/repos/andela/suyabay/deployments","created_at":"2015-09-03T11:00:56Z","updated_at":"2016-01-23T19:28:22Z","pushed_at":"2016-01-27T18:40:32Z","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":16244,"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":14,"forks":3,"open_issues":14,"watchers":4,"default_branch":"staging"}},"base":{"label":"andela:staging","ref":"staging","sha":"441792bed795c6b085d88b0dfcba5e9ce533222e","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}","deployments_url":"https://api.github.com/repos/andela/suyabay/deployments","created_at":"2015-09-03T11:00:56Z","updated_at":"2016-01-23T19:28:22Z","pushed_at":"2016-01-27T18:40:32Z","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":16244,"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":14,"forks":3,"open_issues":14,"watchers":4,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/andela/suyabay/pulls/143"},"html":{"href":"https://github.com/andela/suyabay/pull/143"},"issue":{"href":"https://api.github.com/repos/andela/suyabay/issues/143"},"comments":{"href":"https://api.github.com/repos/andela/suyabay/issues/143/comments"},"review_comments":{"href":"https://api.github.com/repos/andela/suyabay/pulls/143/comments"},"review_comment":{"href":"https://api.github.com/repos/andela/suyabay/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andela/suyabay/pulls/143/commits"},"statuses":{"href":"https://api.github.com/repos/andela/suyabay/statuses/13fc636c4c94fc329afda7f7200d1922633d0adb"}}}}