3

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?

5 Answers5

5

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.

Dilip Hirapara
  • 14,810
  • 3
  • 27
  • 49
  • The POST method is not supported for this route. Supported methods: GET, HEAD. on register itself. Any suggestion? – shadab ambient Feb 21 '20 at 06:57
  • On which URL you're getting it ? make it method `Route::post` – Dilip Hirapara Feb 21 '20 at 07:01
  • The `verification.resend` route should be `post`, [at least in laravel/ui](https://github.com/laravel/ui/blob/3.x/src/AuthRouteMethods.php#L93). `verification.verify` also [requires `/{hash}`](https://github.com/laravel/ui/blob/3.x/src/AuthRouteMethods.php#L92) on the end now. – Don't Panic Sep 14 '21 at 11:10
1

For Laravel 6 and 7 the verification.verify route is

'email/verify/{id}/{hash}'
Sandman
  • 53
  • 1
  • 10
0

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

bldcaveman
  • 153
  • 1
  • 10
  • Inside the file vendor/laravel/framework/src/Illuminate/Auth/Notifications/VerifyEmail.php Check to see if you have: 'hash' => sha1($notifiable->getEmailForVerification()), – bldcaveman Sep 07 '20 at 14:54
0
Route::group(['prefix' => '{locale}',  'where' => ['locale' => '[a-zA-Z]{2}'], 'middleware' => 'setlocale'], function() {
    
    Auth::routes();
    Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');

});
Route::get('email/verify', [App\Http\Controllers\Auth\VerificationController::class,'show'])->name('verification.notice');
Route::get('email/verify/{id}', [App\Http\Controllers\Auth\VerificationController::class,'verify'])->name('verification.verify');
Route::post('email/resend', [App\Http\Controllers\Auth\VerificationController::class,'resend'])->name('verification.resend');

Resend should be Post method! This works in Laravel 8.0

ExpertWeblancer
  • 1,368
  • 1
  • 13
  • 28
0

open your verify.blade.php file

{{ route('verification.resend') }}

replace with

{{ route('verification.resend', app()->getlocale()) }}
Cuddie
  • 15
  • 2