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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 18:06:04  来源:igfitidea点击:

Laravel 5.7 email verification error, route [verification.verify] not defined

phplaravellaravel-5laravel-5.7

提问by hezuxit

I am trying to implement email verification in Laravel 5.7. I have implemented MustVerifyEmailon Usermodel.

我正在尝试在 Laravel 5.7 中实现电子邮件验证。我已经MustVerifyEmailUser模型上实现了。

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\VerificationControllerclass that contains the necessary logic to send verification links and verify emails. To register the necessary routes for this controller, pass the verifyoption to the Auth::routesmethod:

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 中电子邮件验证的工作原理。

https://www.youtube.com/watch?v=dbmox3tgI2k

https://www.youtube.com/watch?v=dbmox3tgI2k

回答by Nahid

In routes/web.phpfile, 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