0

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('/','Main@index');
                Route::get('/dashboard','Main@index')->name('dashboard');
            });
Route::group([
                'prefix'    => 'admins',
                'namespace' => 'Admins',
                'as'        => 'admin.'
            ],function(){
                Auth::routes();
                Route::get('/','Main@index');
                Route::get('/dashboard','Main@index')->name('dashboard');
            });

enter image description here

enter image description here

Vipertecpro
  • 3,056
  • 2
  • 24
  • 43

2 Answers2

2

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('/','Main@index');
                Route::get('/dashboard','Main@index')->name('dashboard');
            });

Route::get('email/verify', 'Users\Auth\VerificationController@show')->name('verification.notice');
Route::get('email/verify/{id}', 'Users\Auth\VerificationController@verify')->name('verification.verify');
Route::get('email/resend', 'Users\Auth\VerificationController@resend')->name('verification.resend');
Route::group([
                'prefix'    => 'users',
                'namespace' => 'Users',
                'as'        => 'user.'
            ],function(){
                Auth::routes();
                Route::get('/','Main@index');
                Route::get('/dashboard','Main@index')->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.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Vipertecpro
  • 3,056
  • 2
  • 24
  • 43
  • In november 2021 `Auth::routes(['verify' => true]); `already handles all. But is necessary add the array: `['verify' => true]`. – bito_ Nov 18 '21 at 10:08
1

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', 'AdminController@showProfile')->middleware('verified:admin.verification.notice');
XenitXTD
  • 59
  • 1
  • 6