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

2021-12-18 00:00:00 php laravel laravel-5 laravel-5.7

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

I am trying to implement email verification in Laravel 5.7. I have implemented MustVerifyEmail on User model.

class User extends Authenticatable implements MustVerifyEmail 
{ 
}

但注册后我收到此错误Route [verification.verify] not defined.

But after registration I got this error Route [verification.verify] not defined.

我缺少什么?请指导?

推荐答案

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

Laravel includes the AuthVerificationController 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:

Auth::routes(['verify' => true]);

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

You can read more information here : https://laravel.com/docs/5.7/verification

相关文章