HDTuto.com

Laravel 5.7 disable registration example


In this example, i would like to share with you how to disable registration route in laravel 5.7 application. you can also remove Authentication Routes, Password Reset Routes and Email Verification Routes from route file.

Actually, few days ago i was working on my laravel 5.7 application and i need to remove register page for customer and i used default Auth::routes() in my web.php file. I used list of all auth routes manually and remove register routes from list. So we can easily remove register route from route file.

As we know laravel provide Auth::routes() for all login, registration, reset password and email verification. You can use default following routes lists instead of Auth::routes().

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');

You can remove from route list that you don't require.




November 15, 2018 | Category : Laravel Laravel 5 Laravel 5.7
Related Posts