/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ public function create(array $data) { $user = User::create(['name' => $data['name'], 'email' => $data['email'], 'birthday' => $data['birthday'], 'password' => bcrypt($data['password'])]); $parentEmail = $data['parentEmail']; $parentUser = User::where('email', $parentEmail)->first(); if ($parentUser != null) { $user->parent()->associate($parentUser); $user->save(); } else { \Session::flash('flash_message', 'No account exists using that email.'); } return $user; }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ public function create(array $data) { $user = new User(); $activation_code = str_random(60) . $data['email']; $user->name = $data['name']; $user->email = $data['email']; $user->password = bcrypt($data['password']); $user->how_know = $data['how_know']; $user->activation_code = $activation_code; if ($user->save()) { \Session::flash('success_message', "Activation link is send to {$data['email']}. Please activite your account"); return view('auth.register'); } }