middleware('guest'); } /** * Get a validator for an incoming registration request. * * @param array $data * @return \Illuminate\Contracts\Validation\Validator */ protected function validator(array $data) { return Validator::make($data, [ 'firstname' => 'required|max:255', 'lastname' => 'required|max:255', 'username' => 'sometimes|required|max:255|unique:users', 'email' => 'required|email|max:255|unique:account', // 'token' => 'required|doorman:email', 'password' => 'required|min:6|confirmed', 'terms' => 'required', ]); } /** * Create a new user instance after a valid registration. * * @param array $data * @return Account */ protected function create(array $data) { $fields = [ 'firstname' => $data['firstname'], 'lastname' => $data['lastname'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'country_id' => 61, // @todo Need to add this to the registration form ]; if (config('auth.providers.users.field','email') === 'username' && isset($data['username'])) { $fields['username'] = $data['username']; } if (config('auth.requiretoken')) { try { Doorman::redeem($data['token'],$data['email']); //@todo This is not working with AdminLTE - need to figure this out. // Want to direct or display an appropriate error message (although the form validation does it anyway). } catch (DoormanException $e) { redirect('/error'); abort(403); } } return Account::create($fields); } }