Esempio n. 1
0
 public function save(Request $request)
 {
     $form = $this->form(UpdateProfileForm::class);
     $form->validate(Member::rules('profile', false), ['nricformat' => 'NRIC checksum failed. Try checking it again.', 'dateformat' => 'Date should be a valid date of the format YYYY-MM-DD']);
     if (!$form->isValid()) {
         return redirect()->back()->with('alert-warning', 'Error in form input!')->withErrors($form->getErrors())->withInput();
     }
     $user = Auth::user();
     // get the first member where the crsid matches and update the model
     $person = Auth::user()->member->update($request->all());
     return redirect()->route('member.profile')->with('alert-success', 'Profile updated.');
 }
Esempio n. 2
0
 public function saveFresher(Request $request)
 {
     $form = $this->form(FreshersSignupForm::class);
     $form->validate(Member::rules('fresher', true), ['nricformat' => 'NRIC checksum failed. Try checking it again.']);
     if (!$form->isValid()) {
         return redirect()->back()->withErrors($form->getErrors())->withInput()->with('alert-warning', 'Error in form input!');
     }
     $fresher = Member::create($request->all());
     $fresher->membership_type = 'Non-member';
     $fresher->registration_time = null;
     $fresher->save();
     if ($request->input('family_join') === '1') {
         // Save CUMSA family preference.
         $family_request = new FamilyRequest();
         $family_request->member()->associate($fresher);
         $family_request->type = 'Child';
         $family_request->save();
     }
     Mail::send('emails.signup', ['user' => $fresher], function ($m) use($fresher) {
         $m->from('*****@*****.**', 'CUMSA');
         $m->to($fresher->email_other, $fresher->first_name)->subject('[CUMSA] Thanks for signing up!');
     });
     return redirect()->route('member.signup.fresher')->with('alert-success', 'Thanks ' . $fresher->first_name . '! You have successfully signed up.');
 }