I have defined routes this way:
/*
* Set up route patterns - patterns will have to be the same as
* in translated route for current language
*/
foreach(Lang::get('routes') as $k => $v) {
Route::pattern($k, $v);
}
Route::group(array('prefix' => Config::get('app.locale_prefix')), function()
{
Route::get('/{login}/', ['as' => 'login', 'uses' => 'LoginController@showLogin']);
});
Depending on selected language {login}
parameter will become login
in English or for example logowanie
in Polish and routes are working fine this way.
However I have problem with creating redirects to named routes.
If I simply use:
Redirect::route('login'));
if will redirect me to http://localhost/{login}
url - parameter won't be changed into login
or logowanie
depending on current language.
On the other hand if I use:
Redirect::route('login', Lang::get('routes'));
and of course in routes.php
file I have many routes it will create the following url:
http://localhost/logowanie?register=rejestracja&dashboard=konto&logout=wyloguj
so it will handle correct {login}
parameter but it will add other array elements to url in query string.
Of course I could use in this case just one element of routes but it will make that for each routes I will have to manually pass selected parameter and not the whole array.
Question - is it possible to pass the whole array of routes as above but make somehow Laravel only to handle parameters that are included in route without adding query string?