@php
$ctxPath = trim((string) request()->path(), '/');
$ctxCat = request()->query('cat');
$pageContext = match (true) {
str_starts_with($ctxPath, 'products/') => 'product',
$ctxPath === 'shop' && $ctxCat === 'laptops' => 'laptops',
$ctxPath === 'shop' => 'shop',
$ctxPath === '' => 'home',
in_array($ctxPath, ['about', 'faq', 'distributor-guide', 'contact'], true) => 'services',
default => 'home',
};
// Resolve store context from route or query param
$storeContext = match (true) {
str_ends_with($ctxPath, 'shop/izone-africa') => 'izone_africa',
str_ends_with($ctxPath, 'shop/magic-city') => 'magic_city',
str_ends_with($ctxPath, 'shop/coming-soon') => 'coming_soon',
str_ends_with($ctxPath, 'shop/all') => 'all',
default => request()->query('store') ?: 'all',
};
// Resolve favicon based on store context
$siteData = $shop['site'] ?? [];
$resolvedFavicon = match ($storeContext) {
'izone_africa' => $siteData['izone_favicon'] ?? $siteData['site_favicon'] ?? null,
'magic_city' => $siteData['magic_city_favicon'] ?? $siteData['site_favicon'] ?? null,
default => $siteData['site_favicon'] ?? null,
};
@endphp
@hasSection('title')@yield('title')@else IZONE Africa × Magic City @endif
@if($resolvedFavicon)
@endif
@vite(['resources/css/shop.css', 'resources/js/shop.js'])
@stack('styles')
@php
$siteSettings = $shop['site'] ?? [];
$resolveLogo = function (?string $settingVal, ?string $brandLogoSrc) use ($siteSettings) {
if (! empty($settingVal)) {
return Str::startsWith($settingVal, '/') || Str::startsWith($settingVal, 'http')
? $settingVal
: asset('storage/' . $settingVal);
}
return $brandLogoSrc ?? '';
};
$izoneBrand = collect($shop['brands'] ?? [])->firstWhere('key', 'izone');
$magicBrand = collect($shop['brands'] ?? [])->firstWhere('key', 'magic');
$resolvedIzoneLogo = $resolveLogo($siteSettings['izone_logo'] ?? null, $izoneBrand['logo_src'] ?? null);
$resolvedMagicLogo = $resolveLogo($siteSettings['magic_city_logo'] ?? null, $magicBrand['logo_src'] ?? null);
$resolvedGlobalLogo = $resolveLogo($siteSettings['site_logo'] ?? null, null);
$resolvedLogos = [
'izone' => $resolvedIzoneLogo ?: $resolvedGlobalLogo,
'magic' => $resolvedMagicLogo ?: $resolvedGlobalLogo,
];
@endphp
@yield('content')
@stack('scripts')