{"action":"created","comment":{"url":"https://api.github.com/repos/PHPEducation/2handstore01/pulls/comments/208140699","pull_request_review_id":143889066,"id":208140699,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwODE0MDY5OQ==","diff_hunk":"@@ -0,0 +1,139 @@\n+<?php\n+\n+namespace App\\Http\\Controllers;\n+\n+use App\\User;\n+use Illuminate\\Http\\Request;\n+use Illuminate\\Support\\Facades\\Storage;\n+\n+class UserController extends Controller\n+{\n+    /**\n+     * Display a listing of the resource.\n+     *\n+     * @return \\Illuminate\\Http\\Response\n+     */\n+    public function index()\n+    {\n+        $users = User::customer()->orderBy('updated_at')->paginate(10);\n+        $page = $users->currentPage();\n+        \n+        return view('admin.users.index', compact(['users', 'page']));\n+    }\n+\n+    public function option(Request $request)\n+    {\n+        $users = User::customer()->option($request->option)->orderBy('updated_at')->paginate(10);\n+        $page = $users->currentPage();\n+\n+        return view('admin.users.userTable', compact(['users', 'page']));\n+    }\n+\n+    /**\n+     * Show the form for creating a new resource.\n+     *\n+     * @return \\Illuminate\\Http\\Response\n+     */\n+    public function create()\n+    {\n+        //\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+        //\n+    }\n+\n+    /**\n+     * Display the specified resource.\n+     *\n+     * @param  int  $id\n+     * @return \\Illuminate\\Http\\Response\n+     */\n+    public function show(Request $request)\n+    {\n+        $user = User::findOrFail($request->id);\n+        return view('admin.users.show', compact('user'));\n+    }\n+\n+    /**\n+     * Show the form for editing the specified resource.\n+     *\n+     * @param  int  $id\n+     * @return \\Illuminate\\Http\\Response\n+     */\n+    public function edit($id)\n+    {\n+        $user = User::findOrFail($id);\n+\n+        return view('admin.users.edit', compact('user'));\n+    }\n+\n+    public function getFilePath(Request $request, $name)\n+    {\n+        $file = $request->file($name);\n+        $fileName = $file->getClientOriginalName();\n+        $filePath = config('filesystems.img_path');\n+        if(file_exists($file)){\n+            $fileName = md5(str_random(15)).$fileName;\n+        }\n+        $path = $file->storeAs($filePath, $fileName);\n+        return $path;\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+        $this->validate($request, [\n+            'avatar' => 'image|max:5120',\n+            'name' => 'string|min:5|max:255',\n+            'description' => 'string|nullable'\n+        ]);\n+\n+        $user = User::findOrFail($id);\n+        \n+        if($request->has('image')){\n+            if($user->avatar !== null) {\n+                Storage::delete($user->avatar);\n+            }\n+            $user->avatar = $this->getFilePath($request, 'image');\n+        }\n+\n+        $user->fill($request->except('avatar'));\n+        $user->save();","path":"app/Http/Controllers/UserController.php","position":115,"original_position":115,"commit_id":"6c5fbd72afe32c584523b7e47f1db51afc7e2c0e","original_commit_id":"6c5fbd72afe32c584523b7e47f1db51afc7e2c0e","user":{"login":"BunnyPi04","id":32006118,"node_id":"MDQ6VXNlcjMyMDA2MTE4","avatar_url":"https://avatars2.githubusercontent.com/u/32006118?v=4","gravatar_id":"","url":"https://api.github.com/users/BunnyPi04","html_url":"https://github.com/BunnyPi04","followers_url":"https://api.github.com/users/BunnyPi04/followers","following_url":"https://api.github.com/users/BunnyPi04/following{/other_user}","gists_url":"https://api.github.com/users/BunnyPi04/gists{/gist_id}","starred_url":"https://api.github.com/users/BunnyPi04/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BunnyPi04/subscriptions","organizations_url":"https://api.github.com/users/BunnyPi04/orgs","repos_url":"https://api.github.com/users/BunnyPi04/repos","events_url":"https://api.github.com/users/BunnyPi04/events{/privacy}","received_events_url":"https://api.github.com/users/BunnyPi04/received_events","type":"User","site_admin":false},"body":"nghiên cứu scope nhé","created_at":"2018-08-07T08:27:43Z","updated_at":"2018-08-07T08:29:06Z","html_url":"https://github.com/PHPEducation/2handstore01/pull/14#discussion_r208140699","pull_request_url":"https://api.github.com/repos/PHPEducation/2handstore01/pulls/14","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/PHPEducation/2handstore01/pulls/comments/208140699"},"html":{"href":"https://github.com/PHPEducation/2handstore01/pull/14#discussion_r208140699"},"pull_request":{"href":"https://api.github.com/repos/PHPEducation/2handstore01/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/PHPEducation/2handstore01/pulls/14","id":206558497,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2NTU4NDk3","html_url":"https://github.com/PHPEducation/2handstore01/pull/14","diff_url":"https://github.com/PHPEducation/2handstore01/pull/14.diff","patch_url":"https://github.com/PHPEducation/2handstore01/pull/14.patch","issue_url":"https://api.github.com/repos/PHPEducation/2handstore01/issues/14","number":14,"state":"open","locked":false,"title":"user manager 2","user":{"login":"2751997nam","id":38351667,"node_id":"MDQ6VXNlcjM4MzUxNjY3","avatar_url":"https://avatars0.githubusercontent.com/u/38351667?v=4","gravatar_id":"","url":"https://api.github.com/users/2751997nam","html_url":"https://github.com/2751997nam","followers_url":"https://api.github.com/users/2751997nam/followers","following_url":"https://api.github.com/users/2751997nam/following{/other_user}","gists_url":"https://api.github.com/users/2751997nam/gists{/gist_id}","starred_url":"https://api.github.com/users/2751997nam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2751997nam/subscriptions","organizations_url":"https://api.github.com/users/2751997nam/orgs","repos_url":"https://api.github.com/users/2751997nam/repos","events_url":"https://api.github.com/users/2751997nam/events{/privacy}","received_events_url":"https://api.github.com/users/2751997nam/received_events","type":"User","site_admin":false},"body":"user manager 2","created_at":"2018-08-07T01:45:45Z","updated_at":"2018-08-07T08:29:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3e9ed7e15dd055664a88d59dfd948a77c597a2ce","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/PHPEducation/2handstore01/pulls/14/commits","review_comments_url":"https://api.github.com/repos/PHPEducation/2handstore01/pulls/14/comments","review_comment_url":"https://api.github.com/repos/PHPEducation/2handstore01/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PHPEducation/2handstore01/issues/14/comments","statuses_url":"https://api.github.com/repos/PHPEducation/2handstore01/statuses/6c5fbd72afe32c584523b7e47f1db51afc7e2c0e","head":{"label":"2751997nam:userMan2","ref":"userMan2","sha":"6c5fbd72afe32c584523b7e47f1db51afc7e2c0e","user":{"login":"2751997nam","id":38351667,"node_id":"MDQ6VXNlcjM4MzUxNjY3","avatar_url":"https://avatars0.githubusercontent.com/u/38351667?v=4","gravatar_id":"","url":"https://api.github.com/users/2751997nam","html_url":"https://github.com/2751997nam","followers_url":"https://api.github.com/users/2751997nam/followers","following_url":"https://api.github.com/users/2751997nam/following{/other_user}","gists_url":"https://api.github.com/users/2751997nam/gists{/gist_id}","starred_url":"https://api.github.com/users/2751997nam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2751997nam/subscriptions","organizations_url":"https://api.github.com/users/2751997nam/orgs","repos_url":"https://api.github.com/users/2751997nam/repos","events_url":"https://api.github.com/users/2751997nam/events{/privacy}","received_events_url":"https://api.github.com/users/2751997nam/received_events","type":"User","site_admin":false},"repo":{"id":143247692,"node_id":"MDEwOlJlcG9zaXRvcnkxNDMyNDc2OTI=","name":"2handstore01","full_name":"2751997nam/2handstore01","owner":{"login":"2751997nam","id":38351667,"node_id":"MDQ6VXNlcjM4MzUxNjY3","avatar_url":"https://avatars0.githubusercontent.com/u/38351667?v=4","gravatar_id":"","url":"https://api.github.com/users/2751997nam","html_url":"https://github.com/2751997nam","followers_url":"https://api.github.com/users/2751997nam/followers","following_url":"https://api.github.com/users/2751997nam/following{/other_user}","gists_url":"https://api.github.com/users/2751997nam/gists{/gist_id}","starred_url":"https://api.github.com/users/2751997nam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2751997nam/subscriptions","organizations_url":"https://api.github.com/users/2751997nam/orgs","repos_url":"https://api.github.com/users/2751997nam/repos","events_url":"https://api.github.com/users/2751997nam/events{/privacy}","received_events_url":"https://api.github.com/users/2751997nam/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/2751997nam/2handstore01","description":null,"fork":true,"url":"https://api.github.com/repos/2751997nam/2handstore01","forks_url":"https://api.github.com/repos/2751997nam/2handstore01/forks","keys_url":"https://api.github.com/repos/2751997nam/2handstore01/keys{/key_id}","collaborators_url":"https://api.github.com/repos/2751997nam/2handstore01/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/2751997nam/2handstore01/teams","hooks_url":"https://api.github.com/repos/2751997nam/2handstore01/hooks","issue_events_url":"https://api.github.com/repos/2751997nam/2handstore01/issues/events{/number}","events_url":"https://api.github.com/repos/2751997nam/2handstore01/events","assignees_url":"https://api.github.com/repos/2751997nam/2handstore01/assignees{/user}","branches_url":"https://api.github.com/repos/2751997nam/2handstore01/branches{/branch}","tags_url":"https://api.github.com/repos/2751997nam/2handstore01/tags","blobs_url":"https://api.github.com/repos/2751997nam/2handstore01/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/2751997nam/2handstore01/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/2751997nam/2handstore01/git/refs{/sha}","trees_url":"https://api.github.com/repos/2751997nam/2handstore01/git/trees{/sha}","statuses_url":"https://api.github.com/repos/2751997nam/2handstore01/statuses/{sha}","languages_url":"https://api.github.com/repos/2751997nam/2handstore01/languages","stargazers_url":"https://api.github.com/repos/2751997nam/2handstore01/stargazers","contributors_url":"https://api.github.com/repos/2751997nam/2handstore01/contributors","subscribers_url":"https://api.github.com/repos/2751997nam/2handstore01/subscribers","subscription_url":"https://api.github.com/repos/2751997nam/2handstore01/subscription","commits_url":"https://api.github.com/repos/2751997nam/2handstore01/commits{/sha}","git_commits_url":"https://api.github.com/repos/2751997nam/2handstore01/git/commits{/sha}","comments_url":"https://api.github.com/repos/2751997nam/2handstore01/comments{/number}","issue_comment_url":"https://api.github.com/repos/2751997nam/2handstore01/issues/comments{/number}","contents_url":"https://api.github.com/repos/2751997nam/2handstore01/contents/{+path}","compare_url":"https://api.github.com/repos/2751997nam/2handstore01/compare/{base}...{head}","merges_url":"https://api.github.com/repos/2751997nam/2handstore01/merges","archive_url":"https://api.github.com/repos/2751997nam/2handstore01/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/2751997nam/2handstore01/downloads","issues_url":"https://api.github.com/repos/2751997nam/2handstore01/issues{/number}","pulls_url":"https://api.github.com/repos/2751997nam/2handstore01/pulls{/number}","milestones_url":"https://api.github.com/repos/2751997nam/2handstore01/milestones{/number}","notifications_url":"https://api.github.com/repos/2751997nam/2handstore01/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/2751997nam/2handstore01/labels{/name}","releases_url":"https://api.github.com/repos/2751997nam/2handstore01/releases{/id}","deployments_url":"https://api.github.com/repos/2751997nam/2handstore01/deployments","created_at":"2018-08-02T05:43:41Z","updated_at":"2018-08-02T05:43:41Z","pushed_at":"2018-08-07T08:25:55Z","git_url":"git://github.com/2751997nam/2handstore01.git","ssh_url":"git@github.com:2751997nam/2handstore01.git","clone_url":"https://github.com/2751997nam/2handstore01.git","svn_url":"https://github.com/2751997nam/2handstore01","homepage":null,"size":259,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"PHPEducation:develop","ref":"develop","sha":"cf9b5f4a1f61eb3ac56fdf72873fff0b7e2ccbf0","user":{"login":"PHPEducation","id":41612083,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxNjEyMDgz","avatar_url":"https://avatars3.githubusercontent.com/u/41612083?v=4","gravatar_id":"","url":"https://api.github.com/users/PHPEducation","html_url":"https://github.com/PHPEducation","followers_url":"https://api.github.com/users/PHPEducation/followers","following_url":"https://api.github.com/users/PHPEducation/following{/other_user}","gists_url":"https://api.github.com/users/PHPEducation/gists{/gist_id}","starred_url":"https://api.github.com/users/PHPEducation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PHPEducation/subscriptions","organizations_url":"https://api.github.com/users/PHPEducation/orgs","repos_url":"https://api.github.com/users/PHPEducation/repos","events_url":"https://api.github.com/users/PHPEducation/events{/privacy}","received_events_url":"https://api.github.com/users/PHPEducation/received_events","type":"Organization","site_admin":false},"repo":{"id":143133979,"node_id":"MDEwOlJlcG9zaXRvcnkxNDMxMzM5Nzk=","name":"2handstore01","full_name":"PHPEducation/2handstore01","owner":{"login":"PHPEducation","id":41612083,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxNjEyMDgz","avatar_url":"https://avatars3.githubusercontent.com/u/41612083?v=4","gravatar_id":"","url":"https://api.github.com/users/PHPEducation","html_url":"https://github.com/PHPEducation","followers_url":"https://api.github.com/users/PHPEducation/followers","following_url":"https://api.github.com/users/PHPEducation/following{/other_user}","gists_url":"https://api.github.com/users/PHPEducation/gists{/gist_id}","starred_url":"https://api.github.com/users/PHPEducation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PHPEducation/subscriptions","organizations_url":"https://api.github.com/users/PHPEducation/orgs","repos_url":"https://api.github.com/users/PHPEducation/repos","events_url":"https://api.github.com/users/PHPEducation/events{/privacy}","received_events_url":"https://api.github.com/users/PHPEducation/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PHPEducation/2handstore01","description":null,"fork":false,"url":"https://api.github.com/repos/PHPEducation/2handstore01","forks_url":"https://api.github.com/repos/PHPEducation/2handstore01/forks","keys_url":"https://api.github.com/repos/PHPEducation/2handstore01/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PHPEducation/2handstore01/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PHPEducation/2handstore01/teams","hooks_url":"https://api.github.com/repos/PHPEducation/2handstore01/hooks","issue_events_url":"https://api.github.com/repos/PHPEducation/2handstore01/issues/events{/number}","events_url":"https://api.github.com/repos/PHPEducation/2handstore01/events","assignees_url":"https://api.github.com/repos/PHPEducation/2handstore01/assignees{/user}","branches_url":"https://api.github.com/repos/PHPEducation/2handstore01/branches{/branch}","tags_url":"https://api.github.com/repos/PHPEducation/2handstore01/tags","blobs_url":"https://api.github.com/repos/PHPEducation/2handstore01/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PHPEducation/2handstore01/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PHPEducation/2handstore01/git/refs{/sha}","trees_url":"https://api.github.com/repos/PHPEducation/2handstore01/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PHPEducation/2handstore01/statuses/{sha}","languages_url":"https://api.github.com/repos/PHPEducation/2handstore01/languages","stargazers_url":"https://api.github.com/repos/PHPEducation/2handstore01/stargazers","contributors_url":"https://api.github.com/repos/PHPEducation/2handstore01/contributors","subscribers_url":"https://api.github.com/repos/PHPEducation/2handstore01/subscribers","subscription_url":"https://api.github.com/repos/PHPEducation/2handstore01/subscription","commits_url":"https://api.github.com/repos/PHPEducation/2handstore01/commits{/sha}","git_commits_url":"https://api.github.com/repos/PHPEducation/2handstore01/git/commits{/sha}","comments_url":"https://api.github.com/repos/PHPEducation/2handstore01/comments{/number}","issue_comment_url":"https://api.github.com/repos/PHPEducation/2handstore01/issues/comments{/number}","contents_url":"https://api.github.com/repos/PHPEducation/2handstore01/contents/{+path}","compare_url":"https://api.github.com/repos/PHPEducation/2handstore01/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PHPEducation/2handstore01/merges","archive_url":"https://api.github.com/repos/PHPEducation/2handstore01/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PHPEducation/2handstore01/downloads","issues_url":"https://api.github.com/repos/PHPEducation/2handstore01/issues{/number}","pulls_url":"https://api.github.com/repos/PHPEducation/2handstore01/pulls{/number}","milestones_url":"https://api.github.com/repos/PHPEducation/2handstore01/milestones{/number}","notifications_url":"https://api.github.com/repos/PHPEducation/2handstore01/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PHPEducation/2handstore01/labels{/name}","releases_url":"https://api.github.com/repos/PHPEducation/2handstore01/releases{/id}","deployments_url":"https://api.github.com/repos/PHPEducation/2handstore01/deployments","created_at":"2018-08-01T09:25:32Z","updated_at":"2018-08-01T09:25:34Z","pushed_at":"2018-08-07T07:58:30Z","git_url":"git://github.com/PHPEducation/2handstore01.git","ssh_url":"git@github.com:PHPEducation/2handstore01.git","clone_url":"https://github.com/PHPEducation/2handstore01.git","svn_url":"https://github.com/PHPEducation/2handstore01","homepage":null,"size":244,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":3,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PHPEducation/2handstore01/pulls/14"},"html":{"href":"https://github.com/PHPEducation/2handstore01/pull/14"},"issue":{"href":"https://api.github.com/repos/PHPEducation/2handstore01/issues/14"},"comments":{"href":"https://api.github.com/repos/PHPEducation/2handstore01/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/PHPEducation/2handstore01/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/PHPEducation/2handstore01/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PHPEducation/2handstore01/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/PHPEducation/2handstore01/statuses/6c5fbd72afe32c584523b7e47f1db51afc7e2c0e"}},"author_association":"NONE"}}
{"actor":{"display_login":"BunnyPi04"}}