我需要关闭我在Laravel 8的注册路径,尝试过
Auth::routes([
'register' => false,
'login' => false,
]);但是应用程序抛出了一个错误。
RuntimeException
In order to use the Auth::routes() method, please install the laravel/ui package.如果有人指出需要改变的地方,就会很感激。
谢谢
发布于 2020-10-16 06:16:53
Laravel 8使用增强身份验证。要从您的laravel应用程序中禁用注册,您需要从位于fortify的/config/fortify.php上禁用它。
'features' => [
// Features::registration(), // disable here
Features::resetPasswords(),
Features::emailVerification(),
Features::updateProfileInformation(),
Features::updatePasswords(),
Features::twoFactorAuthentication(),
],发布于 2021-02-18 18:42:58
在我的routes/web.php的末尾是下面一行:
require __DIR__.'/auth.php';在routes/auth.php中,列出了所有用于用户登录/注册/注销的其他路由。只需注释掉或删除/register路由就可以了。
发布于 2021-03-20 21:51:43
此外,请确保禁用routes/web.php中的相关路由:
Route::get('/register', function() {
return redirect('/login');
});
Route::post('/register', function() {
return redirect('/login');
});为了保持工作整洁,我根据tests/Feature/RegistrationTest.php中的特性测试进行了更改,因此我需要这些重定向。
https://stackoverflow.com/questions/64383602
复制相似问题