+ $userData = $request->all();
+ return $this->registerUser($userData);
+ }
+
+ /**
+ * Register a new user after a registration callback.
+ * @param $socialDriver
+ * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
+ * @throws UserRegistrationException
+ */
+ protected function socialRegisterCallback($socialDriver)
+ {
+ $socialUser = $this->socialAuthService->handleRegistrationCallback($socialDriver);
+ $socialAccount = $this->socialAuthService->fillSocialAccount($socialDriver, $socialUser);
+
+ // Create an array of the user data to create a new user instance
+ $userData = [
+ 'name' => $socialUser->getName(),
+ 'email' => $socialUser->getEmail(),
+ 'password' => str_random(30)
+ ];
+ return $this->registerUser($userData, $socialAccount);
+ }
+
+ /**
+ * The registrations flow for all users.
+ * @param array $userData
+ * @param bool|false|SocialAccount $socialAccount
+ * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
+ * @throws UserRegistrationException
+ * @throws \Oxbow\Exceptions\ConfirmationEmailException
+ */
+ protected function registerUser(array $userData, $socialAccount = false)
+ {
+ if (\Setting::get('registration-restrict')) {