Laravel注册路由不适用于本地化包

时间:2017-11-09 09:50:35

标签: php laravel

我使用此软件包进行本地化https://github.com/mcamara/laravel-localization ...

我已设置'hideDefaultLocaleInURL' => true,。我的默认语言环境是德语,所以当我进入注册页面时,URL为http://localhost:8000/register,一切正常。但是,如果用户选择英语(http://localhost:8000/en/register),它不会注册用户,它只会重定向回注册表。

我认为注册路由定义有问题。有办法解决这个问题吗?

这是我的注册路线列表:

 POST - register - App\Http\Controllers\Auth\RegisterController@register
 GET - register 
 App\Http\Controllers\Auth\RegisterController@showRegistrationForm 
来自本地化包的

和中间件应用于这些路线:

web,localeSessionRedirect,localizat
ionRedirect,guest

1 个答案:

答案 0 :(得分:0)

我有这个,它对我来说很好。试试我的路线设置;

<?php
Route::group(
    [
        'prefix' => LaravelLocalization::setLocale(),
        'middleware' => ['localize', 'localeSessionRedirect', 'localizationRedirect', 'localeViewPath' ]
    ],
    function()
    {
        /**
         * Auth and login routes
         */
        // Authentication Routes...
        Auth::routes();
    }
);
相关问题