Open cherosoullis opened 2 days ago
I am using laravel 11 and livewire with authentication. I have installed the package, and did the following:
Route::group( [ 'prefix' => LaravelLocalization::setLocale(), 'middleware' => ['localeSessionRedirect', 'localizationRedirect', 'localeViewPath'] ], function () { Route::view('/', 'welcome');
require __DIR__ . '/auth.php'; }
);
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 ]);
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" },
Found solution with https://github.com/mcamara/laravel-localization/issues/880
I am using laravel 11 and livewire with authentication. I have installed the package, and did the following:
Route::group( [ 'prefix' => LaravelLocalization::setLocale(), 'middleware' => ['localeSessionRedirect', 'localizationRedirect', 'localeViewPath'] ], function () { Route::view('/', 'welcome');
);
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 ]);
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: