Skip to content

Commit

Permalink
Added customization for Language Switcher's uri (#51)
Browse files Browse the repository at this point in the history
* Added customization for Language Switcher's uri

* Default value for Language Switcher uri, preventing backward compatibility breaks
  • Loading branch information
michal-krolik authored Nov 18, 2023
1 parent 3606f1f commit 1fd54a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions config/lang-country.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@

'lang_switcher_middleware' => ['web'],

'lang_switcher_uri' => 'change_lang_country',

'fallback_based_on_current_locale' => false,
];
2 changes: 1 addition & 1 deletion src/LaravelLangCountryServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function boot(): void

$this->app['router']
->middleware(config('lang-country.lang_switcher_middleware'))
->get('/change_lang_country/{lang_country}', 'Stefro\LaravelLangCountry\Controllers\LangCountrySwitchController@switch')
->get('/' . config('lang-country.lang_switcher_uri','change_lang_country') . '/{lang_country}', 'Stefro\LaravelLangCountry\Controllers\LangCountrySwitchController@switch')
->name('lang_country.switch');

\Event::listen(Login::class, UserAuthenticated::class);
Expand Down

0 comments on commit 1fd54a2

Please sign in to comment.