我正在尝试禁用在 Laravel 5.4 中运行的应用程序上的注册路由.
I am trying to disable the register route on my application which is running in Laravel 5.4.
在我的路由文件中,我只有
In my routes file, I have only the
Auth::routes();
有什么办法可以禁用注册路由吗?
Is there any way to disable the register routes?
code:
Auth::routes();
这是这组路线的捷径:
// Authentication Routes...
Route::get('login', 'AuthLoginController@showLoginForm')->name('login');
Route::post('login', 'AuthLoginController@login');
Route::post('logout', 'AuthLoginController@logout')->name('logout');
// Registration Routes...
Route::get('register', 'AuthRegisterController@showRegistrationForm')->name('register');
Route::post('register', 'AuthRegisterController@register');
// Password Reset Routes...
Route::get('password/reset', 'AuthForgotPasswordController@showLinkRequestForm')->name('password.request');
Route::post('password/email', 'AuthForgotPasswordController@sendResetLinkEmail')->name('password.email');
Route::get('password/reset/{token}', 'AuthResetPasswordController@showResetForm')->name('password.reset');
Route::post('password/reset', 'AuthResetPasswordController@reset');
因此,您可以用路由列表替换第一个,并注释掉您的应用程序中不需要的任何路由.
So you can substitute the first with the list of routes and comment out any route you don't want in your application.
编辑 laravel 版本 =>5.7
在较新的版本中,您可以向 Auth::routes() 函数调用添加一个参数以禁用注册路由:
In newer versions you can add a parameter to the Auth::routes() function call to disable the register routes:
Auth::routes(['register' => false]);
添加了电子邮件验证路径:
The email verification routes were added:
Route::get('email/verify', 'AuthVerificationController@show')->name('verification.notice');
Route::get('email/verify/{id}', 'AuthVerificationController@verify')->name('verification.verify');
Route::get('email/resend', 'AuthVerificationController@resend')->name('verification.resend');
顺便说一句,您还可以禁用 Password Reset 和 Email Verification 路由:
BTW you can also disable Password Reset and Email Verification routes:
Auth::routes(['reset' => false, 'verify' => false]);
这篇关于Laravel 5.4 禁用注册路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
在 Laravel 集合对象中添加新元素add new element in laravel collection object(在 Laravel 集合对象中添加新元素)
在 Laravel 5 中创建编辑模式Creating an edit modal in Laravel 5(在 Laravel 5 中创建编辑模式)
用于集合的 Laravel 5.5 API 资源(独立数据)Laravel 5.5 API resources for collections (standalone data)(用于集合的 Laravel 5.5 API 资源(独立数据))
在 php Laravel 5 中创建自定义辅助函数的最佳实践What is the best practice to create a custom helper function in php Laravel 5?(在 php Laravel 5 中创建自定义辅助函数的最佳实践是什么
没有“Access-Control-Allow-Origin"标头 - LaravelNo #39;Access-Control-Allow-Origin#39; header - Laravel(没有“Access-Control-Allow-Origin标头 - Laravel)
Laravel Passport Route 重定向到登录页面Laravel Passport Route redirects to login page(Laravel Passport Route 重定向到登录页面)