/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { //handle registration emails $name = $data['first_name'] . ' ' . $data['last_name']; //send normal registration email Mail::send('auth.emails.welcome', ['name' => $name], function ($message) use($data) { $message->to($data['email'])->from('*****@*****.**', 'BICO Registration')->subject('Welcome to the BICO Website!'); }); if ($data['instructor'] == 1) { //send instructor weclome email Mail::send('auth.emails.instructor', ['name' => $name], function ($message) use($data) { $message->to($data['email'])->from('*****@*****.**', 'BICO Registration')->subject('Welcome Instructor!'); }); } //convert array of SAR roles into string (because I'm lazy) $sar_role = implode(",", $data['sar_role']); //check for 'other' province if ($data['other'] !== "") { $province = "Other - " . $data['other']; } else { $province = $data['province']; } //create user $user = User::create(['first_name' => $data['first_name'], 'last_name' => $data['last_name'], 'province' => $province, 'sar_role' => $sar_role, 'instructor' => $data['instructor'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); //set up entry in progress table $progress = Progress::create(['user_id' => $user->id]); //TEMPORARY: send to survey after registraion $this->redirectTo = 'http://www.surveygizmo.com/s3/2504752/a81420acc61a'; return $user; }
public function tip() { $team = Auth::user()->team()->first(); $questionNr = count(Progress::where('team_id', $team->id)->get()); $question = Question::where('sequence', $questionNr + 1)->first(); $qt = QuestionTime::where('question_id', $question->id)->where('team_id', $team->id)->first(); $qt->tip = true; $qt->save(); return redirect('/'); }