How to disable registration new users in Laravel
This might be new in 5.7, but there is now an options array to the auth method. Simply changing
Auth::routes();
to
Auth::routes(['register' => false]);
in your routes file after running php artisan make:auth
will disable user registration.
Laravel 5.7 introduced the following functionality:
Auth::routes(['register' => false]);
The currently possible options here are:
Auth::routes([
'register' => false, // Registration Routes...
'reset' => false, // Password Reset Routes...
'verify' => false, // Email Verification Routes...
]);
For older Laravel versions just override showRegistrationForm()
and register()
methods in
AuthController
for Laravel 5.0 - 5.4Auth/RegisterController.php
for Laravel 5.5
public function showRegistrationForm()
{
return redirect('login');
}
public function register()
{
}