Implement ability to disable registration
MODIFY
.env.ci
.env.ci
@@ -41,3 +41,5 @@ PLANS_PREMIUM_MAXIMUM_SPACES=null
STRIPE_KEY=
STRIPE_SECRET=
STRIPE_PREMIUM_PLAN_PRICE_ID=
+
+DISABLE_REGISTRATION=false

MODIFY
.env.example
.env.example
@@ -41,3 +41,5 @@ PLANS_PREMIUM_MAXIMUM_SPACES=null
STRIPE_KEY=
STRIPE_SECRET=
STRIPE_PREMIUM_PLAN_PRICE_ID=
+
+DISABLE_REGISTRATION=false

MODIFY
app/Http/Controllers/RegisterController.php
app/Http/Controllers/RegisterController.php
@@ -29,6 +29,10 @@ class RegisterController extends Controller
public function index()
{
+ if (config('app.disable_registration')) {
+ abort(404);
+ }
+
return view('register', [
'currencies' => Currency::orderBy('name')->get()
]);
@@ -36,6 +40,10 @@ class RegisterController extends Controller
public function store(Request $request)
{
+ if (config('app.disable_registration')) {
+ abort(404);
+ }
+
$request->validate(User::getValidationRulesForRegistration());
$user = (new CreateUserAction())->execute($request->name, $request->email, $request->password);

MODIFY
config/app.php
config/app.php
@@ -222,4 +222,9 @@ return [
'Image' => Intervention\Image\Facades\Image::class
],
+ /**
+ * Custom
+ */
+
+ 'disable_registration' => env('DISABLE_REGISTRATION', false),
];

Implement ability to disable registration