Route [user.verification.notice] not defined / Override EnsureEmailIsVerified?

I’ve been trying to implement multiple authentication login and registration is working fine in both group but verification route is not working after user registration. Is there any way possible to do this ?

This is my route

Route::group([
                'prefix'    => 'users',
                'namespace' => 'Users',
                'as'        => 'user.'
            ],function(){
                Auth::routes(['verify' => true]);
                Route::get('/','<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4b062a22250b22252f2e33">[email protected]</a>');
                Route::get('/dashboard','<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="074a666e69476e6963627f">[email protected]</a>')->name('dashboard');
            });
Route::group([
                'prefix'    => 'admins',
                'namespace' => 'Admins',
                'as'        => 'admin.'
            ],function(){
                Auth::routes();
                Route::get('/','<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f2bf939b9cb29b9c96978a">[email protected]</a>');
                Route::get('/dashboard','<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1558747c7b557c7b71706d">[email protected]</a>')->name('dashboard');
            });

enter image description here

enter image description here

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Okay, I searched a lot but the only way is to handle by manually so I updated my route and it worked here is the code,

Route::group([
                'prefix'    => 'admins',
                'namespace' => 'Admins',
                'as'        => 'admin.'
            ],function(){
                Auth::routes();
                Route::get('/','<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c68ba7afa886afa8a2a3be">[email protected]</a>');
                Route::get('/dashboard','<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6429050d0a240d0a00011c">[email protected]</a>')->name('dashboard');
            });

Route::get('email/verify', 'UsersAuth<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="61370413080708020015080e0f220e0f15130e0d0d04132112090e16">[email protected]</a>')->name('verification.notice');
Route::get('email/verify/{id}', 'UsersAuth<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="50063522393639333124393f3e133f3e24223f3c3c352210263522393629">[email protected]</a>')->name('verification.verify');
Route::get('email/resend', 'UsersAuth<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f0a69582999699939184999f9eb39f9e84829f9c9c9582b0829583959e94">[email protected]</a>')->name('verification.resend');
Route::group([
                'prefix'    => 'users',
                'namespace' => 'Users',
                'as'        => 'user.'
            ],function(){
                Auth::routes();
                Route::get('/','<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d79ab6beb997beb9b3b2af">[email protected]</a>');
                Route::get('/dashboard','<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2469454d4a644d4a40415c">[email protected]</a>')->name('dashboard');
            });

Also I wonder if it would be much easier and simpler if Auth::routes(['verify' => true]); handles all by itself then only thing we’ve to manage is show method in VerificationController, I hope they update this issue in upcoming Laravel versions, but it is also possible that I’m not aware of another way to do it, any help or suggestion appreciated.

Method 2

So this was alternately addressed here

Laracasts::Setting Email Verification Middleware route

Turns out passing the redirectToRoute can be done via the middleware.

$router->middleware(['auth:apiuser', 'verified:api.verification.notice'])

A real world example
Route::get('admin', '<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c584a1a8acab86aaabb1b7aaa9a9a0b785b6adaab295b7aaa3aca9a0">[email protected]</a>')->middleware('verified:admin.verification.notice');


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x