@php $barItems = collect((array) setting('mobile.bar_items', ['home', 'shop', 'search', 'cart', 'account'])) ->filter(fn ($item) => in_array($item, ['home', 'shop', 'search', 'cart', 'account', 'contact'], true)) ->unique() ->values() ->all(); $barStyle = (string) setting('mobile.bar_style', 'floating'); $barStyle = in_array($barStyle, ['classic', 'floating', 'glass'], true) ? $barStyle : 'floating'; $showLabels = (bool) setting('mobile.bar_labels', true); $cartCount = (int) ($cartSummary['count'] ?? 0); $customer = auth('web')->user(); // Each shortcut can use any catalogue icon and its own accent colour. $iconCatalog = (array) config('mobile.icons', []); $savedIcons = (array) setting('mobile.bar_icons', []); $barColors = (array) setting('mobile.bar_colors', []); $icons = []; foreach ((array) config('mobile.items', []) as $iconItem) { $chosen = (string) ($savedIcons[$iconItem] ?? $iconItem); $icons[$iconItem] = (string) ($iconCatalog[$chosen]['path'] ?? ($iconCatalog[$iconItem]['path'] ?? '')); } $tint = fn (string $item) => filled($barColors[$item] ?? null) ? ' style="--mbar-tint: '.e($barColors[$item]).'"' : ''; // A contextual shortcut: filters live in the bar only on the shop page. $activeFilterCount = 0; if (request()->routeIs('shop')) { $activeFilterCount = count(array_filter((array) request('cats'))) + count(array_filter((array) request('attributes'))) + (request()->filled('min') ? 1 : 0) + (request()->filled('max') ? 1 : 0) + (request()->boolean('sale') ? 1 : 0); } $cartActive = request()->routeIs('cart', 'checkout', 'checkout.*'); $accountActive = request()->routeIs('account.*', 'login', 'login.*', 'register', 'password.*', 'otp.*'); @endphp @if ($barItems !== []) @if (in_array('search', $barItems, true))
@endif @endif