{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/hrm_4/pulls/comments/48516479","id":48516479,"diff_hunk":"@@ -0,0 +1,84 @@\n+<?php\n+\n+namespace App\\Http\\Controllers;\n+\n+use Illuminate\\Http\\Request;\n+\n+use App\\Http\\Requests;\n+use App\\Http\\Controllers\\Controller;\n+use App\\Repositories\\PositionRepository;\n+use App\\Repositories\\UserRepository;\n+\n+class PositionsController extends Controller\n+{\n+    protected $positionRepository;\n+    protected $userRepository;\n+\n+    /**\n+     * Create a new controller instance.\n+     *\n+     * @param PositionRepository $positionRepository\n+     * @param UserRepository $userRepository\n+     */\n+    public function __construct(PositionRepository $positionRepository, UserRepository $userRepository)\n+    {\n+        $this->middleware('auth');\n+        $this->positionRepository = $positionRepository;\n+        $this->userRepository = $userRepository;\n+    }\n+\n+    /**\n+     * Display a listing of the resource.\n+     *\n+     * @return \\Illuminate\\Http\\Response\n+     */\n+    public function index()\n+    {\n+        $positions = $this->positionRepository->paginate();\n+        return view('positions', ['positions' => $positions]);\n+    }\n+\n+    /**\n+     * Store a newly created resource in storage.\n+     *\n+     * @param  \\Illuminate\\Http\\Request  $request\n+     * @return \\Illuminate\\Http\\Response\n+     */\n+    public function store(Request $request)\n+    {\n+        $position = $this->positionRepository->create($request->all());\n+        return redirect('positions');\n+    }\n+\n+    /**\n+     * Update the specified resource in storage.\n+     *\n+     * @param  \\Illuminate\\Http\\Request  $request\n+     * @param  int  $id\n+     * @return \\Illuminate\\Http\\Response\n+     */\n+    public function update(Request $request, $id)\n+    {\n+        $position = $this->positionRepository->update($request->except(['_method', '_token']), $id);\n+        return redirect('positions');\n+    }\n+\n+    /**\n+     * Remove the specified resource from storage.\n+     *\n+     * @param  int  $id\n+     * @return \\Illuminate\\Http\\Response\n+     */\n+    public function destroy($id)\n+    {\n+        $users = $this->userRepository->findByField('position_id', $id)->get();\n+        foreach ($users as $user) {\n+            $position = [\n+                'position_id' => null,\n+            ];\n+            $user = $this->userRepository->update($position, $user->id);","path":"app/Http/Controllers/PositionsController.php","position":79,"original_position":79,"commit_id":"65a506f584f42da0c652b6f2037ec94e21f12846","original_commit_id":"65a506f584f42da0c652b6f2037ec94e21f12846","user":{"login":"tieppt07","id":9419172,"avatar_url":"https://avatars.githubusercontent.com/u/9419172?v=3","gravatar_id":"","url":"https://api.github.com/users/tieppt07","html_url":"https://github.com/tieppt07","followers_url":"https://api.github.com/users/tieppt07/followers","following_url":"https://api.github.com/users/tieppt07/following{/other_user}","gists_url":"https://api.github.com/users/tieppt07/gists{/gist_id}","starred_url":"https://api.github.com/users/tieppt07/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tieppt07/subscriptions","organizations_url":"https://api.github.com/users/tieppt07/orgs","repos_url":"https://api.github.com/users/tieppt07/repos","events_url":"https://api.github.com/users/tieppt07/events{/privacy}","received_events_url":"https://api.github.com/users/tieppt07/received_events","type":"User","site_admin":false},"body":"@wataridori Thế thì sẽ sử dụng Model ạ? Đang dùng repository nên em hơi loạn tý ạ :D","created_at":"2015-12-29T01:11:18Z","updated_at":"2015-12-29T01:11:18Z","html_url":"https://github.com/framgia/hrm_4/pull/12#discussion_r48516479","pull_request_url":"https://api.github.com/repos/framgia/hrm_4/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/framgia/hrm_4/pulls/comments/48516479"},"html":{"href":"https://github.com/framgia/hrm_4/pull/12#discussion_r48516479"},"pull_request":{"href":"https://api.github.com/repos/framgia/hrm_4/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/hrm_4/pulls/12","id":54644176,"html_url":"https://github.com/framgia/hrm_4/pull/12","diff_url":"https://github.com/framgia/hrm_4/pull/12.diff","patch_url":"https://github.com/framgia/hrm_4/pull/12.patch","issue_url":"https://api.github.com/repos/framgia/hrm_4/issues/12","number":12,"state":"open","locked":false,"title":"[48922] Manage Positions","user":{"login":"tieppt07","id":9419172,"avatar_url":"https://avatars.githubusercontent.com/u/9419172?v=3","gravatar_id":"","url":"https://api.github.com/users/tieppt07","html_url":"https://github.com/tieppt07","followers_url":"https://api.github.com/users/tieppt07/followers","following_url":"https://api.github.com/users/tieppt07/following{/other_user}","gists_url":"https://api.github.com/users/tieppt07/gists{/gist_id}","starred_url":"https://api.github.com/users/tieppt07/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tieppt07/subscriptions","organizations_url":"https://api.github.com/users/tieppt07/orgs","repos_url":"https://api.github.com/users/tieppt07/repos","events_url":"https://api.github.com/users/tieppt07/events{/privacy}","received_events_url":"https://api.github.com/users/tieppt07/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-28T10:01:20Z","updated_at":"2015-12-29T01:11:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a058ed3dd3676b741268627b31cbb7cf7fc6dbc9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/framgia/hrm_4/pulls/12/commits","review_comments_url":"https://api.github.com/repos/framgia/hrm_4/pulls/12/comments","review_comment_url":"https://api.github.com/repos/framgia/hrm_4/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/hrm_4/issues/12/comments","statuses_url":"https://api.github.com/repos/framgia/hrm_4/statuses/65a506f584f42da0c652b6f2037ec94e21f12846","head":{"label":"tieppt07:manage_position","ref":"manage_position","sha":"65a506f584f42da0c652b6f2037ec94e21f12846","user":{"login":"tieppt07","id":9419172,"avatar_url":"https://avatars.githubusercontent.com/u/9419172?v=3","gravatar_id":"","url":"https://api.github.com/users/tieppt07","html_url":"https://github.com/tieppt07","followers_url":"https://api.github.com/users/tieppt07/followers","following_url":"https://api.github.com/users/tieppt07/following{/other_user}","gists_url":"https://api.github.com/users/tieppt07/gists{/gist_id}","starred_url":"https://api.github.com/users/tieppt07/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tieppt07/subscriptions","organizations_url":"https://api.github.com/users/tieppt07/orgs","repos_url":"https://api.github.com/users/tieppt07/repos","events_url":"https://api.github.com/users/tieppt07/events{/privacy}","received_events_url":"https://api.github.com/users/tieppt07/received_events","type":"User","site_admin":false},"repo":{"id":48213145,"name":"hrm_4","full_name":"tieppt07/hrm_4","owner":{"login":"tieppt07","id":9419172,"avatar_url":"https://avatars.githubusercontent.com/u/9419172?v=3","gravatar_id":"","url":"https://api.github.com/users/tieppt07","html_url":"https://github.com/tieppt07","followers_url":"https://api.github.com/users/tieppt07/followers","following_url":"https://api.github.com/users/tieppt07/following{/other_user}","gists_url":"https://api.github.com/users/tieppt07/gists{/gist_id}","starred_url":"https://api.github.com/users/tieppt07/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tieppt07/subscriptions","organizations_url":"https://api.github.com/users/tieppt07/orgs","repos_url":"https://api.github.com/users/tieppt07/repos","events_url":"https://api.github.com/users/tieppt07/events{/privacy}","received_events_url":"https://api.github.com/users/tieppt07/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tieppt07/hrm_4","description":"Framgia Human Resource Management (training)","fork":true,"url":"https://api.github.com/repos/tieppt07/hrm_4","forks_url":"https://api.github.com/repos/tieppt07/hrm_4/forks","keys_url":"https://api.github.com/repos/tieppt07/hrm_4/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tieppt07/hrm_4/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tieppt07/hrm_4/teams","hooks_url":"https://api.github.com/repos/tieppt07/hrm_4/hooks","issue_events_url":"https://api.github.com/repos/tieppt07/hrm_4/issues/events{/number}","events_url":"https://api.github.com/repos/tieppt07/hrm_4/events","assignees_url":"https://api.github.com/repos/tieppt07/hrm_4/assignees{/user}","branches_url":"https://api.github.com/repos/tieppt07/hrm_4/branches{/branch}","tags_url":"https://api.github.com/repos/tieppt07/hrm_4/tags","blobs_url":"https://api.github.com/repos/tieppt07/hrm_4/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tieppt07/hrm_4/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tieppt07/hrm_4/git/refs{/sha}","trees_url":"https://api.github.com/repos/tieppt07/hrm_4/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tieppt07/hrm_4/statuses/{sha}","languages_url":"https://api.github.com/repos/tieppt07/hrm_4/languages","stargazers_url":"https://api.github.com/repos/tieppt07/hrm_4/stargazers","contributors_url":"https://api.github.com/repos/tieppt07/hrm_4/contributors","subscribers_url":"https://api.github.com/repos/tieppt07/hrm_4/subscribers","subscription_url":"https://api.github.com/repos/tieppt07/hrm_4/subscription","commits_url":"https://api.github.com/repos/tieppt07/hrm_4/commits{/sha}","git_commits_url":"https://api.github.com/repos/tieppt07/hrm_4/git/commits{/sha}","comments_url":"https://api.github.com/repos/tieppt07/hrm_4/comments{/number}","issue_comment_url":"https://api.github.com/repos/tieppt07/hrm_4/issues/comments{/number}","contents_url":"https://api.github.com/repos/tieppt07/hrm_4/contents/{+path}","compare_url":"https://api.github.com/repos/tieppt07/hrm_4/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tieppt07/hrm_4/merges","archive_url":"https://api.github.com/repos/tieppt07/hrm_4/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tieppt07/hrm_4/downloads","issues_url":"https://api.github.com/repos/tieppt07/hrm_4/issues{/number}","pulls_url":"https://api.github.com/repos/tieppt07/hrm_4/pulls{/number}","milestones_url":"https://api.github.com/repos/tieppt07/hrm_4/milestones{/number}","notifications_url":"https://api.github.com/repos/tieppt07/hrm_4/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tieppt07/hrm_4/labels{/name}","releases_url":"https://api.github.com/repos/tieppt07/hrm_4/releases{/id}","created_at":"2015-12-18T03:47:37Z","updated_at":"2015-12-18T03:22:15Z","pushed_at":"2015-12-28T09:58:12Z","git_url":"git://github.com/tieppt07/hrm_4.git","ssh_url":"git@github.com:tieppt07/hrm_4.git","clone_url":"https://github.com/tieppt07/hrm_4.git","svn_url":"https://github.com/tieppt07/hrm_4","homepage":null,"size":89,"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":"9cbd5384c72fcf4ef424f2f48a69f11d6455e6de","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":48212103,"name":"hrm_4","full_name":"framgia/hrm_4","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/hrm_4","description":"Framgia Human Resource Management (training)","fork":false,"url":"https://api.github.com/repos/framgia/hrm_4","forks_url":"https://api.github.com/repos/framgia/hrm_4/forks","keys_url":"https://api.github.com/repos/framgia/hrm_4/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/hrm_4/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/hrm_4/teams","hooks_url":"https://api.github.com/repos/framgia/hrm_4/hooks","issue_events_url":"https://api.github.com/repos/framgia/hrm_4/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/hrm_4/events","assignees_url":"https://api.github.com/repos/framgia/hrm_4/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/hrm_4/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/hrm_4/tags","blobs_url":"https://api.github.com/repos/framgia/hrm_4/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/hrm_4/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/hrm_4/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/hrm_4/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/hrm_4/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/hrm_4/languages","stargazers_url":"https://api.github.com/repos/framgia/hrm_4/stargazers","contributors_url":"https://api.github.com/repos/framgia/hrm_4/contributors","subscribers_url":"https://api.github.com/repos/framgia/hrm_4/subscribers","subscription_url":"https://api.github.com/repos/framgia/hrm_4/subscription","commits_url":"https://api.github.com/repos/framgia/hrm_4/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/hrm_4/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/hrm_4/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/hrm_4/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/hrm_4/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/hrm_4/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/hrm_4/merges","archive_url":"https://api.github.com/repos/framgia/hrm_4/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/hrm_4/downloads","issues_url":"https://api.github.com/repos/framgia/hrm_4/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/hrm_4/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/hrm_4/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/hrm_4/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/hrm_4/labels{/name}","releases_url":"https://api.github.com/repos/framgia/hrm_4/releases{/id}","created_at":"2015-12-18T03:22:15Z","updated_at":"2015-12-18T03:22:15Z","pushed_at":"2015-12-28T10:01:20Z","git_url":"git://github.com/framgia/hrm_4.git","ssh_url":"git@github.com:framgia/hrm_4.git","clone_url":"https://github.com/framgia/hrm_4.git","svn_url":"https://github.com/framgia/hrm_4","homepage":null,"size":81,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/hrm_4/pulls/12"},"html":{"href":"https://github.com/framgia/hrm_4/pull/12"},"issue":{"href":"https://api.github.com/repos/framgia/hrm_4/issues/12"},"comments":{"href":"https://api.github.com/repos/framgia/hrm_4/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/hrm_4/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/hrm_4/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/hrm_4/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/hrm_4/statuses/65a506f584f42da0c652b6f2037ec94e21f12846"}}}}