json([ 'type' => 'error', 'message' => 'User registration is not allowed', ], 401); } // Map registration data $data = CreateUserData::fromArray([ 'name' => $request->input('name'), 'email' => $request->input('email'), 'password' => $request->input('password'), ]); // Register user try { $user = ($this->createNewUser)($data); } catch (MeteredBillingPlanDoesntExist $e) { return response()->json([ 'type' => 'error', 'message' => 'User registrations are temporarily disabled', ], 409); } // Log in if verification is disabled if (! $user->password || ! intval(get_settings('user_verification'))) { $this->guard->login($user); } return response()->json([ 'type' => 'success', 'message' => 'User successfully registered.', ], 201); } }