Laravel Disable Registration Route Example
In this small post, i would like to show you how to disable register route in laravel. if you can disable register route in laravel application. if you have question about how to remove register route in laravel then you are a right place.
You can disable registration route in laravel 6, laravel 7, laravel 8, laravel 9, laravel 10 and laravel 11 application.
I will give you two way to remove register route in laravel. laravel provide by default auth routes and they create login, register, forgot passwords routes but you can easily do it using "Auth::routes(['register' => false]);".
So let's see both way how to remove register route in laravel application.
Example 1:
Here, we will use default auth routes with pass array as argument and pass 'register' false so they will disabled register route in laravel app.
So, you can do it like as bellow:
routes/web.php
Auth::routes(['register' => false]);
You can also disabled 'reset' and 'verify' as like bellow:
Auth::routes([
'register' => false, // Register Routes...
'reset' => false, // Reset Password Routes...
'verify' => false, // Email Verification Routes...
]);
Example 2:
Here, we will create all manually routes in our web.php file instead of they provide auth:routes(). Then you can remove it as you don't required anything. so you can see bellow listed default routes and you can remove any that you not required.
So, you can do it like as bellow:
routes/web.php
/* Authentication Routes... */
Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
Route::post('login', 'Auth\LoginController@login');
Route::post('logout', 'Auth\LoginController@logout')->name('logout');
/* Registration Routes... */
Route::get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
Route::post('register', 'Auth\RegisterController@register');
/* Password Reset Routes... */
Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update');
/* Email Verification Routes... */
Route::get('email/verify', 'Auth\VerificationController@show')->name('verification.notice');
Route::get('email/verify/{id}', 'Auth\VerificationController@verify')->name('verification.verify');
Route::get('email/resend', 'Auth\VerificationController@resend')->name('verification.resend');
I hope it can help you...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- How to Install JQuery UI in Laravel Vite?
- How to Read Content from PDF File in Laravel?
- Laravel Carbon Change Timezone Example
- Laravel Array Length Validation Example
- Laravel 10 Custom Validation Error Message Example
- Laravel Ajax CRUD with Popup Modal Example
- How to Create Custom Middleware in Laravel?
- How to Setup Database in Laravel Vapor?
- Laravel Custom Forgot & Reset Password Example
- Laravel Add Custom Configuration File Example
- How to Define Constant Variable in Laravel?
- Laravel Custom Pagination View Example
- Laravel Create Custom Validation Rule Example