Laravel 5.7电子邮件验证错误,未定义路由[verification.verify]

hez*_*xit 2 php laravel laravel-5 laravel-5.7

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

class User extends Authenticatable implements MustVerifyEmail 
{ 
}
Run Code Online (Sandbox Code Playgroud)

但是注册后我得到了这个错误Route [verification.verify] not defined

我在此缺少什么?请指导?

Chr*_*min 9

Laravel包含的Auth\VerificationController类包含发送验证链接和验证电子邮件的必要逻辑。要为此控制器注册必要的路由,请将verify选项传递给Auth::routes方法:

Auth::routes(['verify' => true]);
Run Code Online (Sandbox Code Playgroud)

您可以在这里阅读更多信息:https : //laravel.com/docs/5.7/verification


小智 6

你缺少Auth::routes(['verify' => true])Routes\Web.php

我建议您观看该视频,其中详细说明了Laravel 5.7中电子邮件验证的工作原理。

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


Nah*_*hid 1

routes/web.php文件中,添加以下代码:

Auth::routes(['verify' => true]);
Run Code Online (Sandbox Code Playgroud)

参考:https: //laravel.com/docs/5.7/verification#verification-routing