我正在尝试在本地化的目的下使用封装在前缀组中的Laravel Auth::routes():
Route::group(['prefix' => '{locale}', 'where' => ['locale' => '[a-zA-Z]{2}']], function () {
Auth::routes();
});
在我的视图中,我现在创建路由时提供当前语言,像这样 route('password.confirm', app()->getLocale())
但是当我尝试使用“忘记密码”功能时,会抛出异常。我认为这是因为Laravel在内部创建了一个密码重置链接,使用了一个没有传递当前语言参数的命名路由。
Illuminate\Routing\Exceptions\UrlGenerationException
Missing required parameter for [Route: password.reset]
[URI: {locale}/password/reset/{token}] [Missing parameter: locale].
有没有可能在某种程度上全局地使用Auth::routes()并注入缺少的“locale”参数?或者在不重写Laravel的身份验证方法的情况下建议的方法是什么?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号