public function saveUser(RegistrationRequest $request, $registrationRole)
 {
     $user = User::create(array_merge($request->except('password_confirmation', '_token'), ['role' => $registrationRole, 'status' => UserStatus::WAITING_FOR_APPROVAL]));
     Event::fire(new UserWasCreated($user));
     if ($request->has('subscribe_to_newsletter')) {
         $this->dispatch(new SubscribeToNewsletter($user));
     }
     if ($user->status == UserStatus::WAITING_FOR_APPROVAL) {
         flash()->message(trans('auth.waitingForApproval'));
         return redirect(route('login'));
     }
     $this->auth->login($user);
     flash()->success('U bent nu ingelogd.');
     return redirect($user->getHomeUrl());
 }
Example #2
0
 public function handleRegister(RegistrationRequest $request, AuthManager $auth)
 {
     $user = User::create($request->all());
     $auth->login($user);
     return redirect()->route('home')->with('message', 'Your account has been created!');
 }