46 lines
No EOL
1.5 KiB
Markdown
46 lines
No EOL
1.5 KiB
Markdown
# Shared Routes Fix - DomainService entfernen
|
|
|
|
## 🚨 Problem
|
|
`routes/shared/common.php` enthält noch `DomainService`-Referenzen, die zu Fehlern führen, da DomainService nicht mehr verfügbar ist.
|
|
|
|
## ✅ Lösung
|
|
Alle DomainService-Aufrufe durch direkte Config-basierte URL-Generierung ersetzen.
|
|
|
|
## 🔧 Fixes für routes/shared/common.php
|
|
|
|
### 1. Legal-Routes-Fix (Lines 18-54)
|
|
Ersetze DomainService durch direkte Config-Abfrage:
|
|
|
|
```php
|
|
// ALT (mit DomainService - funktioniert nicht):
|
|
$domainService = app(\App\Services\DomainService::class);
|
|
$shopUrl = $domainService->buildUrl('shop', '/datenschutz');
|
|
|
|
// NEU (direkte Config - funktioniert):
|
|
$shopHost = config('domains.domains.shop.host');
|
|
$protocol = config('domains.protocol', 'https://');
|
|
$shopUrl = $protocol . $shopHost . '/datenschutz';
|
|
```
|
|
|
|
### 2. Checkout-Routes-Fix (Lines 147-177)
|
|
Domain-Type-Check mit EarlyDomainParser:
|
|
|
|
```php
|
|
// ALT (mit DomainService - funktioniert nicht):
|
|
$domainService = app(\App\Services\DomainService::class);
|
|
$checkoutUrl = $domainService->buildUrl('checkout', '/checkout/card/');
|
|
|
|
// NEU (EarlyDomainParser + Config - funktioniert):
|
|
use App\Services\EarlyDomainParser;
|
|
|
|
// Nur auf Nicht-Checkout-Domains ausführen
|
|
if (EarlyDomainParser::getCurrentDomainType() !== 'checkout') {
|
|
$checkoutHost = config('domains.domains.checkout.host');
|
|
$protocol = config('domains.protocol', 'https://');
|
|
$checkoutUrl = $protocol . $checkoutHost . '/checkout/card/';
|
|
}
|
|
```
|
|
|
|
## 📁 Komplette Fixed Version
|
|
|
|
Hier ist die vollständige korrigierte `routes/shared/common.php`: |