{"action":"created","comment":{"url":"https://api.github.com/repos/idevelopment/Hcrm/pulls/comments/71436755","id":71436755,"diff_hunk":"@@ -2,11 +2,285 @@\n \n namespace App\\Http\\Controllers;\n \n-use Illuminate\\Http\\Request;\n+use App\\Comments;\n+use App\\TicketGroups;\n+use App\\TicketTopics;\n+use App\\Tickets;\n+\n+use App\\InboundMailboxes;\n+use App\\Customers;\n \n+use Illuminate\\Http\\Request;\n use App\\Http\\Requests;\n \n class TicketsController extends Controller\n {\n-    //\n+    /**\n+     * TicketsController constructor.\n+     */\n+    public function __construct()\n+    {\n+        $this->middleware('lang');\n+        $this->middleware('auth');\n+    }\n+\n+    /**\n+     * Get all the tickets\n+     *\n+     * @url    GET: /tickets\n+     * @return \\Illuminate\\Contracts\\View\\Factory|\\Illuminate\\View\\View\n+     */\n+    public function index()\n+    {\n+        if (! auth()->user()->can('list tickets')) {\n+            redirect()->back();\n+        }\n+        $data['tickets'] = Tickets::OrderBy('id', 'DESC')->paginate(10);\n+        return view('tickets.index', $data);\n+    }\n+\n+    /**\n+     * Show the form to creat a new ticket\n+     *\n+     * @url    GET: /tickets/create\n+     * @return \\Illuminate\\Contracts\\View\\Factory|\\Illuminate\\View\\View\n+     */\n+    public function create()\n+    {\n+        if (! auth()->user()->can('create ticket')) {\n+            redirect()->back();\n+        }\n+\n+        $data[\"customers\"] = Customers::orderBy('name', 'ASC')->get();\n+        $data['groups'] = TicketGroups::orderBy('name', 'ASC')->get();\n+        $data['topics'] = TicketTopics::orderBy('name', 'ASC')->get();\n+        return view('tickets.create', $data);\n+    }\n+\n+    /**\n+     * Store the ticket ticket to the database\n+     *\n+     * @url    POST: /tickets/create\n+     * @param  Request $input\n+     * @return \\Illuminate\\Http\\RedirectResponse\n+     */\n+    public function save(Request $input)\n+    {\n+        //Tickets::create($input->except('_token'));\n+        $ticket = new Tickets;\n+        $ticket->customer_id = $input->customer_id;\n+        $ticket->assigned_id = '1';        \n+        $ticket->status_id   = '1';\n+        $ticket->type        = $input->type;\n+        $ticket->priority    = 'Low';\n+        $ticket->subject     = $input->subject;\n+        $ticket->description = $input->message;\n+        $ticket->save();\n+\n+        return redirect()->route('tickets.index');\n+    }\n+\n+    /**\n+     * Get the tickets assigned to the logged in staff member.\n+     *\n+     * @url    GET: /tickets/assigned\n+     * @return \\Illuminate\\Contracts\\View\\Factory|\\Illuminate\\View\\View\n+     */\n+    public function assigned()\n+    {\n+        if (! auth()->user()->can('list tickets')) {\n+            redirect()->back();\n+        }\n+\n+        $userId = auth()->user()->id;\n+        $data['tickets'] = Tickets::where('assigned_id', $userId)->paginate(15);\n+\n+        return view('tickets.index', $data);\n+    }\n+\n+    /**\n+     * Display the ticket details\n+     *\n+     * @url    GET: /tickets/details/{id}\n+     * @param  int $id the ticket id in the database.\n+     * @return \\Illuminate\\Contracts\\View\\Factory|\\Illuminate\\View\\View\n+     */\n+    public function details($id)\n+    {\n+        if (! auth()->user()->can('edit ticket')) {\n+            redirect()->back();\n+        }\n+\n+        $data['ticket'] = Tickets::with('comments.user')->findOrFail($id);\n+        return view('tickets.details', $data);\n+    }\n+\n+    /**\n+     * Update the ticket true inline.\n+     *\n+     * @url:   POST: /tickets/quickUpdateTicket/{id}\n+     * @param  \\Illuminate\\Http\\Request  $request\n+     * @param  int  $id the ticket id in the database.\n+     * @return \\Illuminate\\Http\\Response\n+     */\n+    public function update(Request $request, $id)\n+    {\n+        $ticket = Tickets::findOrFail($id);\n+        $name  = $request->get('name');\n+        $value = $request->get('value');\n+\n+        $ticket->$name = $value;\n+        $ticket->save();\n+        return  redirect()->back();\n+    }\n+\n+    /**\n+     * @url    POST: /comment/{id}\n+     * @param  Requests\\TicketComment $input\n+     * @param  int $id The ticket id in the database.\n+     * @return \\Illuminate\\Http\\RedirectResponse\n+     */\n+    public function ticketReply(Requests\\TicketComment $input, $id)\n+    {\n+        // TODO/ Add phpunit test\n+        $comment = Comments::create([\n+            'comment' => $input->comment,\n+            'user_id' => auth()->user()->id\n+        ])->id;\n+\n+        Tickets::find($id)->comments()->attach($comment);\n+\n+        session()->flash('message', 'comment has been saved');\n+        return redirect()->back();\n+    }\n+\n+    /**\n+     * Manager routing tickets.\n+     *\n+     * @url    GET: /setup/ticketrouting\n+     * @return \\Illuminate\\Contracts\\View\\Factory|\\Illuminate\\View\\View\n+     */\n+    public function manageRouting()\n+    {\n+        $data['mailboxes'] = InboundMailboxes::All();\n+        return view('setup.ticketRoutes', $data);\n+    }\n+\n+    /**\n+     * Store a new ticket.\n+     *\n+     * @url    GET: /tickets/store\n+     * @return \\Illuminate\\Http\\RedirectResponse\n+     */\n+    public function store()\n+    {\n+        if (! auth()->user()->can('create ticket')) {\n+            redirect()->back();\n+        }\n+\n+        // TODO: build up the logic.\n+        return redirect()->back();\n+    }\n+\n+    /**\n+     * Add setup routing.\n+     *\n+     * @url    GET: /setup/ticketrouting/create\n+     * @return \\Illuminate\\Contracts\\View\\Factory|\\Illuminate\\View\\View\n+     */\n+    public function addRouting()\n+    {\n+        $data['groups'] = TicketGroups::all();\n+        return view('setup.createTicketRoute', $data);\n+    }\n+\n+    /**\n+     * Save the mailbox to the database\n+     *\n+     * @url    POST: /setup/ticketrouting/save\n+     * @param  Request $input\n+     * @return \\Illuminate\\Http\\RedirectResponse\n+     */\n+    public function saveRouting(Request $input)\n+    {\n+        InboundMailboxes::create($input->except('_token'));\n+        return redirect()->back();\n+    }\n+\n+    /**\n+     * List all ticket topics.\n+     *\n+     * @url    GET: /setup/tickets/topics\n+     * @return \\Illuminate\\Contracts\\View\\Factory|\\Illuminate\\View\\View\n+     */\n+    public function topics()\n+    {\n+        $data['topics'] = TicketTopics::orderBy('name', 'ASC')->get();\n+        return view('setup.listTicketTopics', $data);\n+    }\n+\n+    /**\n+     * Show a form to create a new topic.\n+     *\n+     * @url    GET: /setup/tickets/topics\n+     * @return \\Illuminate\\Contracts\\View\\Factory|\\Illuminate\\View\\View\n+     */\n+    public function addTopic()\n+    {\n+       $data['groups'] = TicketGroups::orderBy('name', 'ASC')->get();","path":"app/Http/Controllers/TicketsController.php","position":231,"original_position":231,"commit_id":"9ee333586070a163f7d7f63ac8f54ef5d3a07a2d","original_commit_id":"9ee333586070a163f7d7f63ac8f54ef5d3a07a2d","user":{"login":"ghermans","id":1594411,"avatar_url":"https://avatars.githubusercontent.com/u/1594411?v=3","gravatar_id":"","url":"https://api.github.com/users/ghermans","html_url":"https://github.com/ghermans","followers_url":"https://api.github.com/users/ghermans/followers","following_url":"https://api.github.com/users/ghermans/following{/other_user}","gists_url":"https://api.github.com/users/ghermans/gists{/gist_id}","starred_url":"https://api.github.com/users/ghermans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghermans/subscriptions","organizations_url":"https://api.github.com/users/ghermans/orgs","repos_url":"https://api.github.com/users/ghermans/repos","events_url":"https://api.github.com/users/ghermans/events{/privacy}","received_events_url":"https://api.github.com/users/ghermans/received_events","type":"User","site_admin":false},"body":"__[code_sniffer]__\n* Line indented incorrectly; expected at least 8 spaces, found 7","created_at":"2016-07-19T22:33:35Z","updated_at":"2016-07-19T22:33:35Z","html_url":"https://github.com/idevelopment/Hcrm/pull/116#discussion_r71436755","pull_request_url":"https://api.github.com/repos/idevelopment/Hcrm/pulls/116","_links":{"self":{"href":"https://api.github.com/repos/idevelopment/Hcrm/pulls/comments/71436755"},"html":{"href":"https://github.com/idevelopment/Hcrm/pull/116#discussion_r71436755"},"pull_request":{"href":"https://api.github.com/repos/idevelopment/Hcrm/pulls/116"}}},"pull_request":{"url":"https://api.github.com/repos/idevelopment/Hcrm/pulls/116","id":78057704,"html_url":"https://github.com/idevelopment/Hcrm/pull/116","diff_url":"https://github.com/idevelopment/Hcrm/pull/116.diff","patch_url":"https://github.com/idevelopment/Hcrm/pull/116.patch","issue_url":"https://api.github.com/repos/idevelopment/Hcrm/issues/116","number":116,"state":"open","locked":false,"title":"Fix 111","user":{"login":"Tjoosten","id":5157609,"avatar_url":"https://avatars.githubusercontent.com/u/5157609?v=3","gravatar_id":"","url":"https://api.github.com/users/Tjoosten","html_url":"https://github.com/Tjoosten","followers_url":"https://api.github.com/users/Tjoosten/followers","following_url":"https://api.github.com/users/Tjoosten/following{/other_user}","gists_url":"https://api.github.com/users/Tjoosten/gists{/gist_id}","starred_url":"https://api.github.com/users/Tjoosten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tjoosten/subscriptions","organizations_url":"https://api.github.com/users/Tjoosten/orgs","repos_url":"https://api.github.com/users/Tjoosten/repos","events_url":"https://api.github.com/users/Tjoosten/events{/privacy}","received_events_url":"https://api.github.com/users/Tjoosten/received_events","type":"User","site_admin":false},"body":"Rel #111 ","created_at":"2016-07-19T22:06:24Z","updated_at":"2016-07-19T22:33:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"060ed1df422a29680e2c9ab200b081979c84ce06","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/idevelopment/Hcrm/pulls/116/commits","review_comments_url":"https://api.github.com/repos/idevelopment/Hcrm/pulls/116/comments","review_comment_url":"https://api.github.com/repos/idevelopment/Hcrm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/idevelopment/Hcrm/issues/116/comments","statuses_url":"https://api.github.com/repos/idevelopment/Hcrm/statuses/9ee333586070a163f7d7f63ac8f54ef5d3a07a2d","head":{"label":"idevelopment:fix-111","ref":"fix-111","sha":"9ee333586070a163f7d7f63ac8f54ef5d3a07a2d","user":{"login":"idevelopment","id":14967398,"avatar_url":"https://avatars.githubusercontent.com/u/14967398?v=3","gravatar_id":"","url":"https://api.github.com/users/idevelopment","html_url":"https://github.com/idevelopment","followers_url":"https://api.github.com/users/idevelopment/followers","following_url":"https://api.github.com/users/idevelopment/following{/other_user}","gists_url":"https://api.github.com/users/idevelopment/gists{/gist_id}","starred_url":"https://api.github.com/users/idevelopment/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idevelopment/subscriptions","organizations_url":"https://api.github.com/users/idevelopment/orgs","repos_url":"https://api.github.com/users/idevelopment/repos","events_url":"https://api.github.com/users/idevelopment/events{/privacy}","received_events_url":"https://api.github.com/users/idevelopment/received_events","type":"Organization","site_admin":false},"repo":{"id":61381083,"name":"Hcrm","full_name":"idevelopment/Hcrm","owner":{"login":"idevelopment","id":14967398,"avatar_url":"https://avatars.githubusercontent.com/u/14967398?v=3","gravatar_id":"","url":"https://api.github.com/users/idevelopment","html_url":"https://github.com/idevelopment","followers_url":"https://api.github.com/users/idevelopment/followers","following_url":"https://api.github.com/users/idevelopment/following{/other_user}","gists_url":"https://api.github.com/users/idevelopment/gists{/gist_id}","starred_url":"https://api.github.com/users/idevelopment/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idevelopment/subscriptions","organizations_url":"https://api.github.com/users/idevelopment/orgs","repos_url":"https://api.github.com/users/idevelopment/repos","events_url":"https://api.github.com/users/idevelopment/events{/privacy}","received_events_url":"https://api.github.com/users/idevelopment/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/idevelopment/Hcrm","description":"Open-source CRM for hosting companies ","fork":false,"url":"https://api.github.com/repos/idevelopment/Hcrm","forks_url":"https://api.github.com/repos/idevelopment/Hcrm/forks","keys_url":"https://api.github.com/repos/idevelopment/Hcrm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/idevelopment/Hcrm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/idevelopment/Hcrm/teams","hooks_url":"https://api.github.com/repos/idevelopment/Hcrm/hooks","issue_events_url":"https://api.github.com/repos/idevelopment/Hcrm/issues/events{/number}","events_url":"https://api.github.com/repos/idevelopment/Hcrm/events","assignees_url":"https://api.github.com/repos/idevelopment/Hcrm/assignees{/user}","branches_url":"https://api.github.com/repos/idevelopment/Hcrm/branches{/branch}","tags_url":"https://api.github.com/repos/idevelopment/Hcrm/tags","blobs_url":"https://api.github.com/repos/idevelopment/Hcrm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/idevelopment/Hcrm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/idevelopment/Hcrm/git/refs{/sha}","trees_url":"https://api.github.com/repos/idevelopment/Hcrm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/idevelopment/Hcrm/statuses/{sha}","languages_url":"https://api.github.com/repos/idevelopment/Hcrm/languages","stargazers_url":"https://api.github.com/repos/idevelopment/Hcrm/stargazers","contributors_url":"https://api.github.com/repos/idevelopment/Hcrm/contributors","subscribers_url":"https://api.github.com/repos/idevelopment/Hcrm/subscribers","subscription_url":"https://api.github.com/repos/idevelopment/Hcrm/subscription","commits_url":"https://api.github.com/repos/idevelopment/Hcrm/commits{/sha}","git_commits_url":"https://api.github.com/repos/idevelopment/Hcrm/git/commits{/sha}","comments_url":"https://api.github.com/repos/idevelopment/Hcrm/comments{/number}","issue_comment_url":"https://api.github.com/repos/idevelopment/Hcrm/issues/comments{/number}","contents_url":"https://api.github.com/repos/idevelopment/Hcrm/contents/{+path}","compare_url":"https://api.github.com/repos/idevelopment/Hcrm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/idevelopment/Hcrm/merges","archive_url":"https://api.github.com/repos/idevelopment/Hcrm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/idevelopment/Hcrm/downloads","issues_url":"https://api.github.com/repos/idevelopment/Hcrm/issues{/number}","pulls_url":"https://api.github.com/repos/idevelopment/Hcrm/pulls{/number}","milestones_url":"https://api.github.com/repos/idevelopment/Hcrm/milestones{/number}","notifications_url":"https://api.github.com/repos/idevelopment/Hcrm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/idevelopment/Hcrm/labels{/name}","releases_url":"https://api.github.com/repos/idevelopment/Hcrm/releases{/id}","deployments_url":"https://api.github.com/repos/idevelopment/Hcrm/deployments","created_at":"2016-06-17T14:49:28Z","updated_at":"2016-06-28T21:02:26Z","pushed_at":"2016-07-19T22:24:25Z","git_url":"git://github.com/idevelopment/Hcrm.git","ssh_url":"git@github.com:idevelopment/Hcrm.git","clone_url":"https://github.com/idevelopment/Hcrm.git","svn_url":"https://github.com/idevelopment/Hcrm","homepage":null,"size":826,"stargazers_count":1,"watchers_count":1,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":37,"forks":0,"open_issues":37,"watchers":1,"default_branch":"master"}},"base":{"label":"idevelopment:master","ref":"master","sha":"c6a7e6acefb625714805bde80a41d873237149e6","user":{"login":"idevelopment","id":14967398,"avatar_url":"https://avatars.githubusercontent.com/u/14967398?v=3","gravatar_id":"","url":"https://api.github.com/users/idevelopment","html_url":"https://github.com/idevelopment","followers_url":"https://api.github.com/users/idevelopment/followers","following_url":"https://api.github.com/users/idevelopment/following{/other_user}","gists_url":"https://api.github.com/users/idevelopment/gists{/gist_id}","starred_url":"https://api.github.com/users/idevelopment/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idevelopment/subscriptions","organizations_url":"https://api.github.com/users/idevelopment/orgs","repos_url":"https://api.github.com/users/idevelopment/repos","events_url":"https://api.github.com/users/idevelopment/events{/privacy}","received_events_url":"https://api.github.com/users/idevelopment/received_events","type":"Organization","site_admin":false},"repo":{"id":61381083,"name":"Hcrm","full_name":"idevelopment/Hcrm","owner":{"login":"idevelopment","id":14967398,"avatar_url":"https://avatars.githubusercontent.com/u/14967398?v=3","gravatar_id":"","url":"https://api.github.com/users/idevelopment","html_url":"https://github.com/idevelopment","followers_url":"https://api.github.com/users/idevelopment/followers","following_url":"https://api.github.com/users/idevelopment/following{/other_user}","gists_url":"https://api.github.com/users/idevelopment/gists{/gist_id}","starred_url":"https://api.github.com/users/idevelopment/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idevelopment/subscriptions","organizations_url":"https://api.github.com/users/idevelopment/orgs","repos_url":"https://api.github.com/users/idevelopment/repos","events_url":"https://api.github.com/users/idevelopment/events{/privacy}","received_events_url":"https://api.github.com/users/idevelopment/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/idevelopment/Hcrm","description":"Open-source CRM for hosting companies ","fork":false,"url":"https://api.github.com/repos/idevelopment/Hcrm","forks_url":"https://api.github.com/repos/idevelopment/Hcrm/forks","keys_url":"https://api.github.com/repos/idevelopment/Hcrm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/idevelopment/Hcrm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/idevelopment/Hcrm/teams","hooks_url":"https://api.github.com/repos/idevelopment/Hcrm/hooks","issue_events_url":"https://api.github.com/repos/idevelopment/Hcrm/issues/events{/number}","events_url":"https://api.github.com/repos/idevelopment/Hcrm/events","assignees_url":"https://api.github.com/repos/idevelopment/Hcrm/assignees{/user}","branches_url":"https://api.github.com/repos/idevelopment/Hcrm/branches{/branch}","tags_url":"https://api.github.com/repos/idevelopment/Hcrm/tags","blobs_url":"https://api.github.com/repos/idevelopment/Hcrm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/idevelopment/Hcrm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/idevelopment/Hcrm/git/refs{/sha}","trees_url":"https://api.github.com/repos/idevelopment/Hcrm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/idevelopment/Hcrm/statuses/{sha}","languages_url":"https://api.github.com/repos/idevelopment/Hcrm/languages","stargazers_url":"https://api.github.com/repos/idevelopment/Hcrm/stargazers","contributors_url":"https://api.github.com/repos/idevelopment/Hcrm/contributors","subscribers_url":"https://api.github.com/repos/idevelopment/Hcrm/subscribers","subscription_url":"https://api.github.com/repos/idevelopment/Hcrm/subscription","commits_url":"https://api.github.com/repos/idevelopment/Hcrm/commits{/sha}","git_commits_url":"https://api.github.com/repos/idevelopment/Hcrm/git/commits{/sha}","comments_url":"https://api.github.com/repos/idevelopment/Hcrm/comments{/number}","issue_comment_url":"https://api.github.com/repos/idevelopment/Hcrm/issues/comments{/number}","contents_url":"https://api.github.com/repos/idevelopment/Hcrm/contents/{+path}","compare_url":"https://api.github.com/repos/idevelopment/Hcrm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/idevelopment/Hcrm/merges","archive_url":"https://api.github.com/repos/idevelopment/Hcrm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/idevelopment/Hcrm/downloads","issues_url":"https://api.github.com/repos/idevelopment/Hcrm/issues{/number}","pulls_url":"https://api.github.com/repos/idevelopment/Hcrm/pulls{/number}","milestones_url":"https://api.github.com/repos/idevelopment/Hcrm/milestones{/number}","notifications_url":"https://api.github.com/repos/idevelopment/Hcrm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/idevelopment/Hcrm/labels{/name}","releases_url":"https://api.github.com/repos/idevelopment/Hcrm/releases{/id}","deployments_url":"https://api.github.com/repos/idevelopment/Hcrm/deployments","created_at":"2016-06-17T14:49:28Z","updated_at":"2016-06-28T21:02:26Z","pushed_at":"2016-07-19T22:24:25Z","git_url":"git://github.com/idevelopment/Hcrm.git","ssh_url":"git@github.com:idevelopment/Hcrm.git","clone_url":"https://github.com/idevelopment/Hcrm.git","svn_url":"https://github.com/idevelopment/Hcrm","homepage":null,"size":826,"stargazers_count":1,"watchers_count":1,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":37,"forks":0,"open_issues":37,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/idevelopment/Hcrm/pulls/116"},"html":{"href":"https://github.com/idevelopment/Hcrm/pull/116"},"issue":{"href":"https://api.github.com/repos/idevelopment/Hcrm/issues/116"},"comments":{"href":"https://api.github.com/repos/idevelopment/Hcrm/issues/116/comments"},"review_comments":{"href":"https://api.github.com/repos/idevelopment/Hcrm/pulls/116/comments"},"review_comment":{"href":"https://api.github.com/repos/idevelopment/Hcrm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/idevelopment/Hcrm/pulls/116/commits"},"statuses":{"href":"https://api.github.com/repos/idevelopment/Hcrm/statuses/9ee333586070a163f7d7f63ac8f54ef5d3a07a2d"}}}}
{"actor":{"display_login":"ghermans"}}