das marketing frontend wurde auf lokalisierte urls umgestellt.
This commit is contained in:
@@ -78,17 +78,33 @@ class MarketingController extends Controller
|
||||
->with('success', __('marketing.contact.success', [], $locale));
|
||||
}
|
||||
|
||||
public function contactView()
|
||||
public function contactView(Request $request)
|
||||
{
|
||||
return Inertia::render('marketing.Kontakt');
|
||||
$locale = app()->getLocale();
|
||||
$secondSegment = $request->segment(2);
|
||||
$slug = $secondSegment ? '/'.trim((string) $secondSegment, '/') : '/';
|
||||
|
||||
if ($locale === 'en' && $slug === '/kontakt') {
|
||||
return redirect()->route('marketing.contact', [
|
||||
'locale' => $request->route('locale') ?? $locale,
|
||||
], 301);
|
||||
}
|
||||
|
||||
if ($locale === 'de' && $slug === '/contact') {
|
||||
return redirect()->route('kontakt', [
|
||||
'locale' => $request->route('locale') ?? $locale,
|
||||
], 301);
|
||||
}
|
||||
|
||||
return Inertia::render('marketing/Kontakt');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle package purchase flow.
|
||||
*/
|
||||
public function buyPackages(Request $request, $packageId)
|
||||
public function buyPackages(Request $request, string $locale, $packageId)
|
||||
{
|
||||
Log::info('Buy packages called', ['auth' => Auth::check(), 'package_id' => $packageId]);
|
||||
Log::info('Buy packages called', ['auth' => Auth::check(), 'locale' => $locale, 'package_id' => $packageId]);
|
||||
$package = Package::findOrFail($packageId);
|
||||
|
||||
if (! Auth::check()) {
|
||||
@@ -138,7 +154,10 @@ class MarketingController extends Controller
|
||||
if (! $package->paddle_price_id) {
|
||||
Log::warning('Package missing Paddle price id', ['package_id' => $package->id]);
|
||||
|
||||
return redirect()->route('packages', ['highlight' => $package->slug])
|
||||
return redirect()->route('packages', [
|
||||
'locale' => app()->getLocale(),
|
||||
'highlight' => $package->slug,
|
||||
])
|
||||
->with('error', __('marketing.packages.paddle_not_configured'));
|
||||
}
|
||||
|
||||
@@ -149,8 +168,14 @@ class MarketingController extends Controller
|
||||
$this->checkoutSessions->selectProvider($session, CheckoutSession::PROVIDER_PADDLE);
|
||||
|
||||
$checkout = $this->paddleCheckout->createCheckout($tenant, $package, [
|
||||
'success_url' => route('marketing.success', ['packageId' => $package->id]),
|
||||
'return_url' => route('packages', ['highlight' => $package->slug]),
|
||||
'success_url' => route('marketing.success', [
|
||||
'locale' => app()->getLocale(),
|
||||
'packageId' => $package->id,
|
||||
]),
|
||||
'return_url' => route('packages', [
|
||||
'locale' => app()->getLocale(),
|
||||
'highlight' => $package->slug,
|
||||
]),
|
||||
'metadata' => [
|
||||
'checkout_session_id' => $session->id,
|
||||
],
|
||||
@@ -314,22 +339,69 @@ class MarketingController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function occasionsType($type)
|
||||
public function occasionsType(Request $request, string $locale, string $type)
|
||||
{
|
||||
Log::info('OccasionsType hit', [
|
||||
'type' => $type,
|
||||
'locale' => app()->getLocale(),
|
||||
'locale' => $locale,
|
||||
'url' => request()->fullUrl(),
|
||||
'route' => request()->route()->getName(),
|
||||
'isInertia' => request()->header('X-Inertia'),
|
||||
]);
|
||||
|
||||
$validTypes = ['hochzeit', 'geburtstag', 'firmenevent', 'konfirmation'];
|
||||
if (! in_array($type, $validTypes)) {
|
||||
$normalized = strtolower($type);
|
||||
$typeMap = [
|
||||
'hochzeit' => 'hochzeit',
|
||||
'wedding' => 'hochzeit',
|
||||
'geburtstag' => 'geburtstag',
|
||||
'birthday' => 'geburtstag',
|
||||
'firmenevent' => 'firmenevent',
|
||||
'corporate-event' => 'firmenevent',
|
||||
'konfirmation' => 'konfirmation',
|
||||
'confirmation' => 'konfirmation',
|
||||
];
|
||||
|
||||
if (! array_key_exists($normalized, $typeMap)) {
|
||||
Log::warning('Invalid occasion type accessed', ['type' => $type]);
|
||||
abort(404, 'Invalid occasion type');
|
||||
}
|
||||
|
||||
return Inertia::render('marketing/Occasions', ['type' => $type]);
|
||||
$baseSlug = $typeMap[$normalized];
|
||||
|
||||
$canonical = [
|
||||
'hochzeit' => [
|
||||
'de' => 'hochzeit',
|
||||
'en' => 'wedding',
|
||||
],
|
||||
'geburtstag' => [
|
||||
'de' => 'geburtstag',
|
||||
'en' => 'birthday',
|
||||
],
|
||||
'firmenevent' => [
|
||||
'de' => 'firmenevent',
|
||||
'en' => 'corporate-event',
|
||||
],
|
||||
'konfirmation' => [
|
||||
'de' => 'konfirmation',
|
||||
'en' => 'confirmation',
|
||||
],
|
||||
];
|
||||
|
||||
$canonicalSlug = $canonical[$baseSlug][$locale] ?? $baseSlug;
|
||||
$currentSlug = strtolower($type);
|
||||
|
||||
if ($currentSlug !== $canonicalSlug) {
|
||||
$routeName = $locale === 'en' ? 'occasions.type' : 'anlaesse.type';
|
||||
|
||||
return redirect()->route($routeName, [
|
||||
'locale' => $locale,
|
||||
'type' => $canonicalSlug,
|
||||
], 301);
|
||||
}
|
||||
|
||||
return Inertia::render('marketing/Occasions', [
|
||||
'type' => $baseSlug,
|
||||
'requestedType' => $normalized,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user