Laravel 5.7 邮件验证错误,路由 [verification.verify] 未定义
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/52653533/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel 5.7 email verification error, route [verification.verify] not defined
提问by hezuxit
I am trying to implement email verification in Laravel 5.7. I have implemented MustVerifyEmail
on User
model.
我正在尝试在 Laravel 5.7 中实现电子邮件验证。我已经MustVerifyEmail
在User
模型上实现了。
class User extends Authenticatable implements MustVerifyEmail
{
}
But after registration I got this error Route [verification.verify] not defined
.
但是注册后我收到了这个错误Route [verification.verify] not defined
。
What I am missing in this? Please guide?
我在这缺少什么?请指导?
回答by Christian Gallarmin
Laravel includes the Auth\VerificationController
class that contains the necessary logic to send verification links and verify emails. To register the necessary routes for this controller, pass the verify
option to the Auth::routes
method:
Laravel 包含的Auth\VerificationController
类包含发送验证链接和验证电子邮件的必要逻辑。要为此控制器注册必要的路由,请将verify
选项传递给该Auth::routes
方法:
Auth::routes(['verify' => true]);
You can read more information here : https://laravel.com/docs/5.7/verification
您可以在此处阅读更多信息:https: //laravel.com/docs/5.7/verification
回答by Harish Kumar
You are missing Auth::routes(['verify' => true])
in Routes\Web.php
.
你Auth::routes(['verify' => true])
在Routes\Web.php
.
I suggest watch this video, where it has explained in detail how email verification works in Laravel 5.7.
我建议观看此视频,其中详细解释了 Laravel 5.7 中电子邮件验证的工作原理。
回答by Nahid
In routes/web.php
file, add following piece of code:
在routes/web.php
文件中,添加以下代码:
Auth::routes(['verify' => true]);
Ref: https://laravel.com/docs/5.7/verification#verification-routing
参考:https: //laravel.com/docs/5.7/verification#verification-routing