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

﹥>﹥吖頭↗ 提交于 2020-12-25 02:32:36

问题


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

class User extends Authenticatable implements MustVerifyEmail 
{ 
}

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

What I am missing in this? Please guide?


回答1:


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:

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

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




回答2:


You are missing Auth::routes(['verify' => true]) in Routes\Web.php.

I suggest watch this video, where it has explained in detail how email verification works in Laravel 5.7.

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




回答3:


In routes/web.php file, add following piece of code:

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

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




回答4:


In routes/web.php ensure Auth::routes(['verify' => true]); Then run :

php artisan route:cache

to clear cached routed and update incoming changes




回答5:


You can remove 'verified' middleware, for example:

<?php

Route::middleware(['auth', 'verified'])
    ->group(function(){

     ...

});

?>

Try it, should solve the problem




回答6:


Run:

php artisan optimize:clear

It will clear your cache.



来源:https://stackoverflow.com/questions/52653533/laravel-5-7-email-verification-error-route-verification-verify-not-defined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!