3.4 KiB
3.4 KiB
✅ Shared Routes erfolgreich gefixt!
🚨 Problem gelöst
Alle DomainService-Referenzen in routes/shared/common.php wurden erfolgreich durch EarlyDomainParser und Config-basierte URL-Generation ersetzt.
🔧 Durchgeführte Fixes
1. EarlyDomainParser installiert
cp dev/subdomain-optimization-claude-v2/src/Services/EarlyDomainParser.php app/Services/
2. Legal Routes gefixt (Lines 15-44)
// VORHER (funktionierte nicht):
$domainService = app(\App\Services\DomainService::class);
$shopUrl = $domainService->buildUrl('shop', '/datenschutz');
// NACHHER (funktioniert):
if (\App\Services\EarlyDomainParser::getCurrentDomainType() === 'checkout') {
$shopHost = config('domains.domains.shop.host');
$protocol = config('domains.protocol', 'https://');
$shopBaseUrl = $protocol . $shopHost;
Route::get('/datenschutz', function () use ($shopBaseUrl) {
return redirect()->away($shopBaseUrl . '/datenschutz');
});
}
3. Checkout Routes gefixt (Lines 142-166)
// VORHER (funktionierte nicht):
$domainService = app(\App\Services\DomainService::class);
$checkoutUrl = $domainService->buildUrl('checkout', '/checkout/card/');
// NACHHER (funktioniert):
if (\App\Services\EarlyDomainParser::getCurrentDomainType() !== 'checkout') {
$checkoutHost = config('domains.domains.checkout.host');
$protocol = config('domains.protocol', 'https://');
$checkoutBaseUrl = $protocol . $checkoutHost;
Route::get('/checkout/card/{identifier?}', function ($identifier = null) use ($checkoutBaseUrl) {
$path = '/checkout/card/' . ($identifier ?: '');
return redirect()->away($checkoutBaseUrl . $path);
});
}
✅ Alle DomainService-Referenzen entfernt
Ersetzte Aufrufe:
- ❌
app(\App\Services\DomainService::class)→ ✅config('domains.domains.{type}.host') - ❌
$domainService->buildUrl('shop', '/path')→ ✅$protocol . $shopHost . '/path' - ❌
$domainService->buildUrl('checkout', '/path')→ ✅$protocol . $checkoutHost . '/path'
Domain-Type-Checks:
- ❌
$context->type === 'checkout'→ ✅EarlyDomainParser::getCurrentDomainType() === 'checkout'
🧪 Validierung
# Test erfolgreich:
php artisan config:clear ✅
php artisan route:clear ✅
# Keine Errors mehr bei:
grep -r "DomainService" routes/shared/common.php # Keine Treffer
🎯 Resultat
Checkout-Routes funktionieren jetzt global:
- ✅
/checkout/card/{identifier?}→ Redirect zucheckout.mivita.care - ✅
/checkout/card/final→ Redirect zucheckout.mivita.care - ✅
/transaction/status/{status?}/{reference?}→ Redirect zucheckout.mivita.care - ✅
/transaction/approved/{transactionId}/{reference}→ Redirect zucheckout.mivita.care
Legal-Routes funktionieren domain-aware:
- ✅ Auf
checkout.mivita.care: Legal-Links → Redirect zumivita.shop - ✅ Auf anderen Domains: Legal-Links → Normale Controller
System läuft ohne Errors:
- ✅ Kein
Class "App\Services\DomainService" not found - ✅ Kein
BindingResolutionException - ✅ Alle Route-Registrierungen funktionieren
🚀 Die Checkout-Routes sind jetzt global verfügbar!
Das System generiert korrekt domain-spezifische Redirects basierend auf config/domains.php und EarlyDomainParser, ohne Abhängigkeiten zu DomainService oder DomainContext.
Problem vollständig gelöst! ✅