mcamara / laravel-localization

Easy localization for Laravel
MIT License
3.32k stars 507 forks source link

Livewire login and register 404 error #907

Open cherosoullis opened 2 days ago

cherosoullis commented 2 days ago

I am using laravel 11 and livewire with authentication. I have installed the package, and did the following:

  1. Use in reoutes ->web

Route::group( [ 'prefix' => LaravelLocalization::setLocale(), 'middleware' => ['localeSessionRedirect', 'localizationRedirect', 'localeViewPath'] ], function () { Route::view('/', 'welcome');

     require __DIR__ . '/auth.php';
}

);

  1. I have added in Bootstrap ->providers $middleware->alias([ / OTHER MIDDLEWARE / 'localize' => \Mcamara\LaravelLocalization\Middleware\LaravelLocalizationRoutes::class, 'localizationRedirect' => \Mcamara\LaravelLocalization\Middleware\LaravelLocalizationRedirectFilter::class, 'localeSessionRedirect' => \Mcamara\LaravelLocalization\Middleware\LocaleSessionRedirect::class, 'localeCookieRedirect' => \Mcamara\LaravelLocalization\Middleware\LocaleCookieRedirect::class, 'localeViewPath' => \Mcamara\LaravelLocalization\Middleware\LaravelLocalizationViewPath::class ]);

    1. I also added in providers ->AppServiceProvider use \Mcamara\LaravelLocalization\Traits\LoadsTranslatedCachedRoutes;

    public function boot(): void { RouteServiceProvider::loadCachedRoutesUsing(fn() => $this->loadCachedRoutes());

    }

    But after all this I got to login page http://mywebpage.test/en/login or http://magirevo.test/en/register

and after login or register I get a 404 page

The route en/register could not be found.

This is my composer with installs:

"require": {
    "php": "^8.2",
    "laravel/framework": "^11.9",
    "laravel/tinker": "^2.9",
    "livewire/livewire": "^3.5",
    "livewire/volt": "^1.6",
    "mcamara/laravel-localization": "^2.0",
    "robsontenorio/mary": "^1.34",
    "spatie/laravel-translatable": "^6.7"
},
cherosoullis commented 2 days ago

Found solution with https://github.com/mcamara/laravel-localization/issues/880