Posts Learn Components Snippets Categories Tags Tools new About
/

How to Disable New User Registration in Laravel

Learn how to disable new user registration in Laravel using these several ways

Created on Nov 14, 2021

18 views

There are several ways to disable new user registration in Laravel and you get to each of the methods below.

Method 1: Disable Registration Via Laravel Fortify


If you installed Laravel with Fortify then you can change config/fortify.php configuration and comment out the "Features::registration()" features.
<?php

'features' => [
    // Features::registration(), // --------> comment out this
    Features::resetPasswords(),
    // Features::emailVerification(),
    Features::updateProfileInformation(),
    Features::updatePasswords(),
    Features::twoFactorAuthentication(),
],

Method 2: Set Register Route to False


The 2nd method is to set the registration route to false and you can easily do so from within the "routes/web.php" file itself.
<?php

Auth::routes(['register' => false]);

Method 3: Redirect User to Somewhere Else


The 3rd method is to redirect user to somewhere else after accessing the "/register" path and you can do so from within the "routes/web.php".
<?php

// Redirect from register page to home page
Route::get('/register', function () {
    return redirect('/');
});

If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️

)