{"action":"created","comment":{"url":"https://api.github.com/repos/CUMSA/members/pulls/comments/74894409","id":74894409,"diff_hunk":"@@ -0,0 +1,77 @@\n+<?php\n+\n+namespace App\\Http\\Controllers\\Profile;\n+\n+use Kris\\LaravelFormBuilder\\FormBuilderTrait;\n+use Illuminate\\Http\\Request;\n+use App\\Member;\n+use App\\Forms\\UpdateProfileForm;\n+use App\\Http\\Requests;\n+use App\\Http\\Controllers\\Controller;\n+use Auth;\n+use JsValidator;\n+use Session;\n+\n+class ProfileController extends Controller\n+{\n+    use FormBuilderTrait;\n+\t\n+    public function show()\n+    {\n+\t\t$user = Auth::user();\n+\t\t\n+\t\tif($user === null){\n+\t\t\tSession::put('alert-login', 'Please login to view/update your profile');\n+\t\t\treturn redirect('login');\n+\t\t}\n+\t\t\n+        $form = $this->form(UpdateProfileForm::class,[\n+            'method' => 'POST',\n+            'url' => route('member.profile.update'),\n+        ]);\n+        return view('members.profile.index', compact('form'))->with([\n+            'validator' => JsValidator::make($this->profileRules()),\n+        ]);\n+    }\n+\t\n+\tpublic function save(Request $request)\n+\t{\n+\t\t$form = $this->form(UpdateProfileForm::class);\n+        $form->validate($this->profileRules(), [\n+            'nricformat' => 'NRIC checksum failed. Try checking it again.',\n+            'dateformat' => 'Date should be a valid date of the format YYYY-MM-DD',\n+        ]);\n+        if (!$form->isValid()) {\n+            return redirect()->back()->with('alert-warning', 'Error in form input!')->withErrors($form->getErrors())->withInput();\n+        }\n+\t\t\n+\t\t$user = Auth::user();\n+\t\t// get the first member where the crsid matches and update the model\n+\t\t$person = Member::where('crsid', $user->crsid)\n+\t\t\t->first()\n+\t\t\t->update($request->all());\n+\t\treturn redirect()->route('member.profile')->with('alert-success', 'Profile updated.');\n+\t}\n+\t\n+\tpublic function profileRules(){\n+\t\t$rules = [\n+            'first_name' => 'required',\n+            'last_name' => 'required',\n+            'gender' => 'required',\n+            'date_of_birth' => 'sometimes|required|dateformat:Y-m-d',\n+            'email_other' => 'required|email',\n+            'email_hermes' => 'sometimes|required|email',","path":"app/Http/Controllers/Profile/ProfileController.php","position":63,"original_position":63,"commit_id":"2b1a7627322390624a8587d71758ce47a4d82971","original_commit_id":"2b1a7627322390624a8587d71758ce47a4d82971","user":{"login":"spencerthang","id":8005141,"avatar_url":"https://avatars.githubusercontent.com/u/8005141?v=3","gravatar_id":"","url":"https://api.github.com/users/spencerthang","html_url":"https://github.com/spencerthang","followers_url":"https://api.github.com/users/spencerthang/followers","following_url":"https://api.github.com/users/spencerthang/following{/other_user}","gists_url":"https://api.github.com/users/spencerthang/gists{/gist_id}","starred_url":"https://api.github.com/users/spencerthang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spencerthang/subscriptions","organizations_url":"https://api.github.com/users/spencerthang/orgs","repos_url":"https://api.github.com/users/spencerthang/repos","events_url":"https://api.github.com/users/spencerthang/events{/privacy}","received_events_url":"https://api.github.com/users/spencerthang/received_events","type":"User","site_admin":false},"body":"Try a regex ending with *cam.ac.uk, pretty sure department emails are subdomains of cam.ac.uk, e.g. cl.cam.ac.uk, phy.cam.ac.uk, etc.","created_at":"2016-08-16T08:27:56Z","updated_at":"2016-08-16T08:27:56Z","html_url":"https://github.com/CUMSA/members/pull/17#discussion_r74894409","pull_request_url":"https://api.github.com/repos/CUMSA/members/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/CUMSA/members/pulls/comments/74894409"},"html":{"href":"https://github.com/CUMSA/members/pull/17#discussion_r74894409"},"pull_request":{"href":"https://api.github.com/repos/CUMSA/members/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/CUMSA/members/pulls/17","id":81424197,"html_url":"https://github.com/CUMSA/members/pull/17","diff_url":"https://github.com/CUMSA/members/pull/17.diff","patch_url":"https://github.com/CUMSA/members/pull/17.patch","issue_url":"https://api.github.com/repos/CUMSA/members/issues/17","number":17,"state":"open","locked":false,"title":"profile","user":{"login":"tanhanliang","id":17226585,"avatar_url":"https://avatars.githubusercontent.com/u/17226585?v=3","gravatar_id":"","url":"https://api.github.com/users/tanhanliang","html_url":"https://github.com/tanhanliang","followers_url":"https://api.github.com/users/tanhanliang/followers","following_url":"https://api.github.com/users/tanhanliang/following{/other_user}","gists_url":"https://api.github.com/users/tanhanliang/gists{/gist_id}","starred_url":"https://api.github.com/users/tanhanliang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tanhanliang/subscriptions","organizations_url":"https://api.github.com/users/tanhanliang/orgs","repos_url":"https://api.github.com/users/tanhanliang/repos","events_url":"https://api.github.com/users/tanhanliang/events{/privacy}","received_events_url":"https://api.github.com/users/tanhanliang/received_events","type":"User","site_admin":false},"body":"after blundering around for a long time,\r\nadded temporary memberships (pending payment) and 'Non-member' to Member::membership_type\r\nadded success/fail messages to member, fresher signup and profile update forms\r\nadded profile update, redirect to login if not signed in\r\nfixed fresher rules (it used member rules and would always fail)\r\n","created_at":"2016-08-16T07:09:58Z","updated_at":"2016-08-16T08:27:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"546dc98e37477e4c6d4e25f6254d60af9f27f17a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/CUMSA/members/pulls/17/commits","review_comments_url":"https://api.github.com/repos/CUMSA/members/pulls/17/comments","review_comment_url":"https://api.github.com/repos/CUMSA/members/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CUMSA/members/issues/17/comments","statuses_url":"https://api.github.com/repos/CUMSA/members/statuses/2b1a7627322390624a8587d71758ce47a4d82971","head":{"label":"CUMSA:profile","ref":"profile","sha":"2b1a7627322390624a8587d71758ce47a4d82971","user":{"login":"CUMSA","id":16955519,"avatar_url":"https://avatars.githubusercontent.com/u/16955519?v=3","gravatar_id":"","url":"https://api.github.com/users/CUMSA","html_url":"https://github.com/CUMSA","followers_url":"https://api.github.com/users/CUMSA/followers","following_url":"https://api.github.com/users/CUMSA/following{/other_user}","gists_url":"https://api.github.com/users/CUMSA/gists{/gist_id}","starred_url":"https://api.github.com/users/CUMSA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CUMSA/subscriptions","organizations_url":"https://api.github.com/users/CUMSA/orgs","repos_url":"https://api.github.com/users/CUMSA/repos","events_url":"https://api.github.com/users/CUMSA/events{/privacy}","received_events_url":"https://api.github.com/users/CUMSA/received_events","type":"Organization","site_admin":false},"repo":{"id":51270579,"name":"members","full_name":"CUMSA/members","owner":{"login":"CUMSA","id":16955519,"avatar_url":"https://avatars.githubusercontent.com/u/16955519?v=3","gravatar_id":"","url":"https://api.github.com/users/CUMSA","html_url":"https://github.com/CUMSA","followers_url":"https://api.github.com/users/CUMSA/followers","following_url":"https://api.github.com/users/CUMSA/following{/other_user}","gists_url":"https://api.github.com/users/CUMSA/gists{/gist_id}","starred_url":"https://api.github.com/users/CUMSA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CUMSA/subscriptions","organizations_url":"https://api.github.com/users/CUMSA/orgs","repos_url":"https://api.github.com/users/CUMSA/repos","events_url":"https://api.github.com/users/CUMSA/events{/privacy}","received_events_url":"https://api.github.com/users/CUMSA/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CUMSA/members","description":"Members Database and Event Registration","fork":false,"url":"https://api.github.com/repos/CUMSA/members","forks_url":"https://api.github.com/repos/CUMSA/members/forks","keys_url":"https://api.github.com/repos/CUMSA/members/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CUMSA/members/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CUMSA/members/teams","hooks_url":"https://api.github.com/repos/CUMSA/members/hooks","issue_events_url":"https://api.github.com/repos/CUMSA/members/issues/events{/number}","events_url":"https://api.github.com/repos/CUMSA/members/events","assignees_url":"https://api.github.com/repos/CUMSA/members/assignees{/user}","branches_url":"https://api.github.com/repos/CUMSA/members/branches{/branch}","tags_url":"https://api.github.com/repos/CUMSA/members/tags","blobs_url":"https://api.github.com/repos/CUMSA/members/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CUMSA/members/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CUMSA/members/git/refs{/sha}","trees_url":"https://api.github.com/repos/CUMSA/members/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CUMSA/members/statuses/{sha}","languages_url":"https://api.github.com/repos/CUMSA/members/languages","stargazers_url":"https://api.github.com/repos/CUMSA/members/stargazers","contributors_url":"https://api.github.com/repos/CUMSA/members/contributors","subscribers_url":"https://api.github.com/repos/CUMSA/members/subscribers","subscription_url":"https://api.github.com/repos/CUMSA/members/subscription","commits_url":"https://api.github.com/repos/CUMSA/members/commits{/sha}","git_commits_url":"https://api.github.com/repos/CUMSA/members/git/commits{/sha}","comments_url":"https://api.github.com/repos/CUMSA/members/comments{/number}","issue_comment_url":"https://api.github.com/repos/CUMSA/members/issues/comments{/number}","contents_url":"https://api.github.com/repos/CUMSA/members/contents/{+path}","compare_url":"https://api.github.com/repos/CUMSA/members/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CUMSA/members/merges","archive_url":"https://api.github.com/repos/CUMSA/members/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CUMSA/members/downloads","issues_url":"https://api.github.com/repos/CUMSA/members/issues{/number}","pulls_url":"https://api.github.com/repos/CUMSA/members/pulls{/number}","milestones_url":"https://api.github.com/repos/CUMSA/members/milestones{/number}","notifications_url":"https://api.github.com/repos/CUMSA/members/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CUMSA/members/labels{/name}","releases_url":"https://api.github.com/repos/CUMSA/members/releases{/id}","deployments_url":"https://api.github.com/repos/CUMSA/members/deployments","created_at":"2016-02-07T22:58:11Z","updated_at":"2016-07-24T22:19:08Z","pushed_at":"2016-08-16T07:09:59Z","git_url":"git://github.com/CUMSA/members.git","ssh_url":"git@github.com:CUMSA/members.git","clone_url":"https://github.com/CUMSA/members.git","svn_url":"https://github.com/CUMSA/members","homepage":null,"size":4101,"stargazers_count":1,"watchers_count":1,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"CUMSA:master","ref":"master","sha":"5e3a98e5009e7507b6944c1563ed3fc3e5018cc4","user":{"login":"CUMSA","id":16955519,"avatar_url":"https://avatars.githubusercontent.com/u/16955519?v=3","gravatar_id":"","url":"https://api.github.com/users/CUMSA","html_url":"https://github.com/CUMSA","followers_url":"https://api.github.com/users/CUMSA/followers","following_url":"https://api.github.com/users/CUMSA/following{/other_user}","gists_url":"https://api.github.com/users/CUMSA/gists{/gist_id}","starred_url":"https://api.github.com/users/CUMSA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CUMSA/subscriptions","organizations_url":"https://api.github.com/users/CUMSA/orgs","repos_url":"https://api.github.com/users/CUMSA/repos","events_url":"https://api.github.com/users/CUMSA/events{/privacy}","received_events_url":"https://api.github.com/users/CUMSA/received_events","type":"Organization","site_admin":false},"repo":{"id":51270579,"name":"members","full_name":"CUMSA/members","owner":{"login":"CUMSA","id":16955519,"avatar_url":"https://avatars.githubusercontent.com/u/16955519?v=3","gravatar_id":"","url":"https://api.github.com/users/CUMSA","html_url":"https://github.com/CUMSA","followers_url":"https://api.github.com/users/CUMSA/followers","following_url":"https://api.github.com/users/CUMSA/following{/other_user}","gists_url":"https://api.github.com/users/CUMSA/gists{/gist_id}","starred_url":"https://api.github.com/users/CUMSA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CUMSA/subscriptions","organizations_url":"https://api.github.com/users/CUMSA/orgs","repos_url":"https://api.github.com/users/CUMSA/repos","events_url":"https://api.github.com/users/CUMSA/events{/privacy}","received_events_url":"https://api.github.com/users/CUMSA/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CUMSA/members","description":"Members Database and Event Registration","fork":false,"url":"https://api.github.com/repos/CUMSA/members","forks_url":"https://api.github.com/repos/CUMSA/members/forks","keys_url":"https://api.github.com/repos/CUMSA/members/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CUMSA/members/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CUMSA/members/teams","hooks_url":"https://api.github.com/repos/CUMSA/members/hooks","issue_events_url":"https://api.github.com/repos/CUMSA/members/issues/events{/number}","events_url":"https://api.github.com/repos/CUMSA/members/events","assignees_url":"https://api.github.com/repos/CUMSA/members/assignees{/user}","branches_url":"https://api.github.com/repos/CUMSA/members/branches{/branch}","tags_url":"https://api.github.com/repos/CUMSA/members/tags","blobs_url":"https://api.github.com/repos/CUMSA/members/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CUMSA/members/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CUMSA/members/git/refs{/sha}","trees_url":"https://api.github.com/repos/CUMSA/members/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CUMSA/members/statuses/{sha}","languages_url":"https://api.github.com/repos/CUMSA/members/languages","stargazers_url":"https://api.github.com/repos/CUMSA/members/stargazers","contributors_url":"https://api.github.com/repos/CUMSA/members/contributors","subscribers_url":"https://api.github.com/repos/CUMSA/members/subscribers","subscription_url":"https://api.github.com/repos/CUMSA/members/subscription","commits_url":"https://api.github.com/repos/CUMSA/members/commits{/sha}","git_commits_url":"https://api.github.com/repos/CUMSA/members/git/commits{/sha}","comments_url":"https://api.github.com/repos/CUMSA/members/comments{/number}","issue_comment_url":"https://api.github.com/repos/CUMSA/members/issues/comments{/number}","contents_url":"https://api.github.com/repos/CUMSA/members/contents/{+path}","compare_url":"https://api.github.com/repos/CUMSA/members/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CUMSA/members/merges","archive_url":"https://api.github.com/repos/CUMSA/members/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CUMSA/members/downloads","issues_url":"https://api.github.com/repos/CUMSA/members/issues{/number}","pulls_url":"https://api.github.com/repos/CUMSA/members/pulls{/number}","milestones_url":"https://api.github.com/repos/CUMSA/members/milestones{/number}","notifications_url":"https://api.github.com/repos/CUMSA/members/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CUMSA/members/labels{/name}","releases_url":"https://api.github.com/repos/CUMSA/members/releases{/id}","deployments_url":"https://api.github.com/repos/CUMSA/members/deployments","created_at":"2016-02-07T22:58:11Z","updated_at":"2016-07-24T22:19:08Z","pushed_at":"2016-08-16T07:09:59Z","git_url":"git://github.com/CUMSA/members.git","ssh_url":"git@github.com:CUMSA/members.git","clone_url":"https://github.com/CUMSA/members.git","svn_url":"https://github.com/CUMSA/members","homepage":null,"size":4101,"stargazers_count":1,"watchers_count":1,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CUMSA/members/pulls/17"},"html":{"href":"https://github.com/CUMSA/members/pull/17"},"issue":{"href":"https://api.github.com/repos/CUMSA/members/issues/17"},"comments":{"href":"https://api.github.com/repos/CUMSA/members/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/CUMSA/members/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/CUMSA/members/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CUMSA/members/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/CUMSA/members/statuses/2b1a7627322390624a8587d71758ce47a4d82971"}}}}
{"actor":{"display_login":"spencerthang"}}