Home / Snippets / How to Disable New User Registration in Laravel
How to Disable New User Registration in Laravel cover

How to Disable New User Registration in Laravel

442

3 years ago

0 comments

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('/');
});
notion avatar

Alaz

Week-end developer currently experimenting with web, mobile, and all things programming.

Topics:

Frontend

Resource

Average

Average

Support Us

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

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this