Md Obydullah Follow I'm Md Obydullah. I build open-source projects and write about Laravel, Linux server, modern JavaScript and web development.

How to Disable New User Registration in Laravel

Published on February 11, 2020 29 sec read

In this short article, I would like to share how to disable new user registration in Laravel. Let’s see the way:

For New Versions

This method will work for new versions of Laravel. This method works might be from 5.6/5.7.

Open routes > web.php and simply change:

Auth::routes();

to:

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

Using this method, you’re able to disable/enable register, reset password and email verification routes. Here’s the example:

Auth::routes([
  'register' => false, // Register Route
  'reset' => false, // Reset Password Route
  'verify' => false, // Email Verification Route
]);

For Older Versions

If the first method doesn’t work on your Laravel app, try this method. Open AuthController or RegisterController (find any of this from your app) and simply modify showRegistrationForm() and register() methods.

public function showRegistrationForm()
{
    return redirect('login');
}

public function register()
{
    // empty
}

You're welcome to suggest any article to write!

Md Obydullah Follow I'm Md Obydullah. I build open-source projects and write about Laravel, Linux server, modern JavaScript and web development.

Leave a Reply

Your email address will not be published. Required fields are marked *