@php $locale = app()->getLocale(); $switchLocale = $locale === 'ar' ? 'en' : 'ar'; $currentRoute = request()->route(); $currentRouteName = $currentRoute?->getName(); $currentRouteParams = $currentRoute?->parameters() ?? []; $currentRouteParams['locale'] = $switchLocale; $switchUrl = $currentRouteName ? route($currentRouteName, $currentRouteParams) : route('home', ['locale' => $switchLocale]); $homeUrl = route('home', ['locale' => $locale]); @endphp