Hi guys...so I have a problem that ate my last 2 hours and I still haven't figured it out. I'm starting to believe that it's impossible to achieve but still I decided to ask in here
So I have a multilanguage website... for blog posts and others I am using Model<->ModelTranslation relationship to gather dynamic slugs and all.
Now I also need dynamic slugs for the hardcoded pages so to speak...
The routing for these looks like this
Route::group(
[
'prefix' => '{locale}',
'where' => ['locale' => '[a-zA-Z]{2}'],
'middleware' => 'localization'
], function(){
...
Route::get('/pricing', 'FrontPageController@products')->name('products');
...
}
);
This results in The following routes:
site.com/en/pricing
site.com/fr/pricing
site.com/cn/pricing
But obviously this is not an ideal setup
What I want to achieve is to gather the "locale" parameter passed in the prefix to assign a dynamic slug to that pricing string in order to have more user-friendly URLs
Creating databases is not a solution because the website is already in production and this is more of a "nice to have" feature rather than something crucial.
So if I manage to access that {locale} variable in the second part of the function it would be great because I could create a config file with different variations... and have something like
Route::get(config('routing')['services'][$lang], 'FrontPageController@products')->name('products');
Thanks a lot
Marian