type === 'checkout') { // Für Checkout-Domain: Umleitung zur Shop-Domain Route::get('/datenschutz', function () { $domainService = app(\App\Services\DomainService::class); $shopUrl = $domainService->buildUrl('shop', '/datenschutz'); return redirect()->away($shopUrl); })->name('legal.data-protected'); Route::get('/impressum', function () { $domainService = app(\App\Services\DomainService::class); $shopUrl = $domainService->buildUrl('shop', '/impressum'); return redirect()->away($shopUrl); })->name('legal.imprint'); Route::get('/agb', function () { $domainService = app(\App\Services\DomainService::class); $shopUrl = $domainService->buildUrl('shop', '/agb'); return redirect()->away($shopUrl); })->name('legal.agb'); Route::get('/kontakt', function () { $domainService = app(\App\Services\DomainService::class); $shopUrl = $domainService->buildUrl('shop', '/kontakt'); return redirect()->away($shopUrl); })->name('contact.create'); Route::get('/zahlungsarten', function () { $domainService = app(\App\Services\DomainService::class); $shopUrl = $domainService->buildUrl('shop', '/zahlungsarten'); return redirect()->away($shopUrl); })->name('zahlungsarten'); Route::get('/versandkosten', function () { $domainService = app(\App\Services\DomainService::class); $shopUrl = $domainService->buildUrl('shop', '/versandkosten'); return redirect()->away($shopUrl); })->name('versandkosten'); } else { // Für alle anderen Domains: normale Controller-Routen Route::get('/datenschutz', 'HomeController@legalDataProtected')->name('legal.data-protected'); Route::get('/impressum', 'HomeController@legalImprint')->name('legal.imprint'); Route::get('/agb', 'HomeController@legalAGB')->name('legal.agb'); Route::get('/kontakt', 'Web\ContactController@create')->name('contact.create'); Route::post('/kontakt', 'Web\ContactController@store')->name('contact.store'); Route::get('/zahlungsarten', 'HomeController@zahlungsarten')->name('zahlungsarten'); Route::get('/versandkosten', 'HomeController@versandkosten')->name('versandkosten'); } // File storage route für alle Domains (Rechnungen, Downloads, etc.) // Auth-Prüfung erfolgt im FileController selbst je nach Kontext Route::get('/storage/file/{id}/{from}/{do?}', 'FileController@show')->name('storage_file'); // Sprachwechsler Route::post('/change_website_lang', 'Web\SiteController@changeLang')->name('language.change'); // Route für den Sprachwechsel (aus alter utility.php wiederhergestellt) Route::get('translation/{locale}', function ($locale) { app()->setLocale($locale); session()->put('locale', $locale); // Optional: Sprache für eingeloggte Benutzer speichern if (auth()->guard('user')->check()) { auth()->guard('user')->user()->update(['lang' => $locale]); } if (auth()->guard('customers')->check()) { auth()->guard('customers')->user()->update(['language' => $locale]); } return redirect()->back(); })->name('translation'); // Bild-Routen (aus alter utility.php wiederhergestellt) Route::get('/product/image/{slug}', function ($slug = null) { if ($image = \App\Models\ProductImage::where('slug', 'like', $slug)->first()) { $path = storage_path('app/public') . '/images/product' . '/' . $image->product_id . '/' . $image->filename; if (file_exists($path)) { return response()->file($path); } } abort(404); })->name('product_image'); Route::get('storage/images/{from}/{slug}', function ($from = null, $slug = null) { if ($from == 'shop') { if ($image = \App\Models\UserShop::where('filename', $slug)->first()) { $path = storage_path('app/public') . '/images/shop' . '/' . $image->filename; if (file_exists($path)) { return Response::file($path); } } } })->name('storage_images'); Route::get('/iq/image/{slug}', function ($slug = null) { if ($image = \App\Models\IqImage::where('slug', $slug)->first()) { $path = storage_path('app/public') . '/images/iq_images/' . $image->filename; if (file_exists($path)) { return Response::file($path); } } })->name('iq_image'); Route::get('/user_shop/image/{slug}', function ($slug = null) { if ($image = \App\Models\UserShopOnSite::where('slug', $slug)->first()) { $path = storage_path('app/public') . '/images/user_shop' . '/' . $image->user_shop_id . '/' . $image->filename; if (file_exists($path)) { return Response::file($path); } } })->name('user_shop_image'); Route::get('/shop/product/image/{slug}', function ($slug = null) { if ($image = \App\Models\ProductImage::where('slug', $slug)->first()) { $path = storage_path('app/public') . '/images/product' . '/' . $image->product_id . '/' . $image->filename; if (file_exists($path)) { return Response::file($path); } } })->name('shop_product_image'); // Alias für /home, damit auch /home erreichbar ist // Checkout-Weiterleitung nur für Domains, die NICHT checkout.* sind $context = app(\App\Domain\DomainContext::class); if ($context->type !== 'checkout') { Route::get('/checkout/card/{identifier?}', function ($identifier = null) { $domainService = app(\App\Services\DomainService::class); $checkoutUrl = $domainService->buildUrl('checkout', '/checkout/card/' . $identifier, null); return redirect()->away($checkoutUrl); })->name('checkout.checkout_card'); Route::post('/checkout/card/final', function () { $domainService = app(\App\Services\DomainService::class); $checkoutUrl = $domainService->buildUrl('checkout', '/checkout/card/final', null); return redirect()->away($checkoutUrl); })->name('checkout.checkout_card_final'); // Weiterleitung für Transaktionsstatus Route::get('/transaction/status/{status?}/{reference?}', function ($status = null, $reference = null) { $domainService = app(\App\Services\DomainService::class); $checkoutUrl = $domainService->buildUrl('checkout', "/transaction/status/{$status}/{$reference}", null); return redirect()->away($checkoutUrl); })->name('checkout.transaction_status'); Route::post('/transaction/status/{status?}/{reference?}', function ($status = null, $reference = null) { $domainService = app(\App\Services\DomainService::class); $checkoutUrl = $domainService->buildUrl('checkout', "/transaction/status/{$status}/{$reference}", null); return redirect()->away($checkoutUrl); })->name('checkout.transaction_status_post'); Route::get('/transaction/approved/{transactionId}/{reference}', function ($transactionId, $reference) { $domainService = app(\App\Services\DomainService::class); $checkoutUrl = $domainService->buildUrl('checkout', "/transaction/approved/{$transactionId}/{$reference}", null); return redirect()->away($checkoutUrl); })->name('checkout.transaction_approved'); } Route::get('/register/verify/{confirmationCode}', 'HomeController@verify')->name('register_verify');