Missing required parameters for [Route: verification.verify] [URI: {locale}/email/verify/{id}/{hash}]

邮差的信 提交于 2021-02-07 23:25:13

问题


In registration process, while sending verification email issue with adding {locale}. Data is being added to database. But thereafter giving following issue.

Missing required parameters for [Route: verification.verify] [URI: {locale}/email/verify/{id}/{hash}].

I think it will be some type of overriding the verification process.

web.php

Route::group([
  'prefix' => '{locale}', 
  'where' => ['locale' => '[a-zA-Z]{2}'], 
  'middleware' => 'setlocale'], function() {
Auth::routes(['verify' => true]);

Route::get('/home', 'HomeController@index')->name('home');
});

Route::get('/', function () {
    return redirect(app()->getLocale());
});

vendor/laravel/framework/src/Illuminate/Routing/Router.php

$this->get('email/verify/{id}/{hash}', 'Auth\VerificationController@verify')->name('verification.verify');

I know in router {locale} is not matching with the routing. But how to resolve this?


回答1:


Instead of using Auth::routes(['verify' => true]); just use Auth::routes(); and manually add these routes:

Route::get('email/verify', 'Auth\VerificationController@show')->name('verification.notice');
Route::get('email/verify/{id}', 'Auth\VerificationController@verify')->name('verification.verify');
Route::get('email/resend', 'Auth\VerificationController@resend')->name('verification.resend');

Route::group([ 'prefix' => '{locale}', 'where' => ['locale' => '[a-zA-Z]{2}'], 'middleware' => 'setlocale'], function() { 
    Auth::routes();
    Route::get('/home', 'HomeController@index')->name('home'); 
}); 

check SO answer.




回答2:


For Laravel 6 and 7 the verification.verify route is

'email/verify/{id}/{hash}'



回答3:


Laravel 6.0 - Custom email verification: temporarySignedRoute() URL not working with new route

Check this out if you're having this because for me it was a custom verify link



来源:https://stackoverflow.com/questions/60333284/missing-required-parameters-for-route-verification-verify-uri-locale-emai

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