10.April 2026
This commit is contained in:
parent
a00c42e770
commit
f58c709945
208 changed files with 19280 additions and 2914 deletions
|
|
@ -63,15 +63,20 @@ Route::post('/change_website_lang', 'Web\SiteController@changeLang')->name('lang
|
|||
|
||||
// Route für den Sprachwechsel (aus alter utility.php wiederhergestellt)
|
||||
Route::get('translation/{locale}', function ($locale) {
|
||||
app()->setLocale($locale);
|
||||
session()->put('locale', $locale);
|
||||
$normalized = \App\Services\LocaleGuard::normalize($locale);
|
||||
if ($normalized === null) {
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
app()->setLocale($normalized);
|
||||
session()->put('locale', $normalized);
|
||||
|
||||
// Optional: Sprache für eingeloggte Benutzer speichern
|
||||
if (auth()->guard('user')->check()) {
|
||||
auth()->guard('user')->user()->update(['lang' => $locale]);
|
||||
auth()->guard('user')->user()->update(['lang' => $normalized]);
|
||||
}
|
||||
if (auth()->guard('customers')->check()) {
|
||||
auth()->guard('customers')->user()->update(['language' => $locale]);
|
||||
auth()->guard('customers')->user()->update(['language' => $normalized]);
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue