[路由:验证.验证] [URI:{locale}/email/verify/{id}/{hash}]缺少必需的参数 [英] Missing required parameters for [Route: verification.verify] [URI: {locale}/email/verify/{id}/{hash}]

查看:50
本文介绍了[路由:验证.验证] [URI:{locale}/email/verify/{id}/{hash}]缺少必需的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在注册过程中,发送带有{locale}的验证电子邮件时.数据正在添加到数据库.但是此后,出现了以下问题.

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

缺少[路由:verify.verify] [URI:{locale}/email/verify/{id}/{hash}]所需的参数.

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.

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');

我知道路由器{locale}中的路由与路由不匹配.但是如何解决呢?

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

推荐答案

不是使用 Auth :: routes(['verify'=> true]); ,而是使用 Auth::routes(); 并手动添加以下路由:

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'); 
}); 

检查 SO答案.

这篇关于[路由:验证.验证] [URI:{locale}/email/verify/{id}/{hash}]缺少必需的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆