@php $siteTitle = \App\Models\Setting::cached('site_title') ?? config('app.name','KalaRhea'); $siteTagline = \App\Models\Setting::cached('site_tagline') ?? 'Fashion For Your Story'; $siteFavicon = \App\Models\Setting::cached('site_favicon'); $siteLogo = \App\Models\Setting::cached('site_logo'); $footerContent = json_decode(\App\Models\Setting::cached('page_content_footer') ?? '{}', true) ?? []; $defaultSocials = [ ['name' => 'Instagram', 'url' => '#', 'icon' => 'fa-brands fa-instagram'], ['name' => 'TikTok', 'url' => '#', 'icon' => 'fa-brands fa-tiktok'], ['name' => 'Facebook', 'url' => '#', 'icon' => 'fa-brands fa-facebook-f'], ['name' => 'YouTube', 'url' => '#', 'icon' => 'fa-brands fa-youtube'], ]; $socials = !empty($footerContent['footer_social_media']) ? (array) $footerContent['footer_social_media'] : $defaultSocials; $footerEcommerce = array_values(array_filter( (array) ($footerContent['footer_ecommerce'] ?? []), fn ($s) => is_array($s) && (trim((string) ($s['name'] ?? '')) !== '' || trim((string) ($s['url'] ?? '')) !== '' || ! empty($s['image'])) )); if ($footerEcommerce === [] && ! empty($footerContent['footer_ecommerce_image'])) { // Kompatibilitas dengan data lama (satu gambar e-commerce). $footerEcommerce = [['name' => 'E-commerce', 'url' => '#', 'image' => $footerContent['footer_ecommerce_image']]]; } @endphp {{-- e() mencegah stored XSS: section title bisa memuat nama produk/blog yang dikontrol admin. Blade @yield mengeluarkan konten mentah. --}} {{ e($__env->yieldContent('title', $siteTitle)) }} @if($siteFavicon) @else @endif {{-- Canonical URL: tanpa query string (sort/filter/search) agar Google tidak dianggap konten duplikat per variasi parameter. --}} @php $canonicalUrl = rtrim(request()->url(), '/'); $currentPath = parse_url($canonicalUrl, PHP_URL_PATH); $supportedCountries = \App\Support\CountryContext::supported(); $currentCode = country()->code(); // Buang prefix negara dari path untuk mendapatkan base path, // lalu bangun URL setara per negara untuk hreflang. $basePath = preg_replace('#^/(id|sg)(/|$)#', '/$2', $currentPath); if ($basePath === '' || $basePath === '/') { $basePath = '/'; } @endphp @foreach($supportedCountries as $code => $cfg) @endforeach @vite(['resources/css/app.css', 'resources/js/app.js']) @php $defaultOrder = ['home','shop','collections','blog','about','contact']; $stored = json_decode(\App\Models\Setting::cached('header_menu_order') ?? '', true); $menuOrder = is_array($stored) && $stored ? array_values(array_unique(array_merge($stored, array_diff($defaultOrder, $stored)))) : $defaultOrder; $menuLabels = [ 'home' => __('Home'), 'shop' => __('Shop'), 'collections' => __('Collection'), 'blog' => __('Blog'), 'about' => __('About Us'), 'contact' => __('Contact Us'), ]; $menuUrls = [ 'home' => country_url('/'), 'shop' => country_url('/shop'), 'collections' => country_url('/collections'), 'blog' => country_url('/blog'), 'about' => country_url('/about'), 'contact' => country_url('/contact'), ]; // Dipakai routeIs agar tidak bergantung pada path ber-prefix negara. $menuActive = [ 'home' => fn () => request()->routeIs('home'), 'shop' => fn () => request()->routeIs('shop', 'product.show'), 'collections' => fn () => request()->routeIs('collections.*'), 'blog' => fn () => request()->routeIs('blog.*'), 'about' => fn () => request()->routeIs('about'), 'contact' => fn () => request()->routeIs('contact'), ]; // Mega menu data for collections — di-cache (array biasa, karena // serialisasi class ke cache dibatasi config) agar navigasi tidak // menghitung ulang kategori + produk terbaru di setiap request. $megaCategories = collect(); if (class_exists(\App\Models\Category::class)) { $megaCategories = collect(\Illuminate\Support\Facades\Cache::remember('mega-menu', now()->addMinutes(10), function () { $categories = \App\Models\Category::where('is_active', true)->whereHas('products')->withCount('products')->orderByDesc('products_count')->limit(6)->get(); $catIds = $categories->pluck('id'); $latestProducts = \DB::table('category_product') ->select('category_id', \DB::raw('MAX(product_id) as pid')) ->whereIn('category_id', $catIds) ->groupBy('category_id') ->get() ->keyBy('category_id'); $products = \App\Models\Product::with('images')->whereIn('id', $latestProducts->pluck('pid'))->get()->keyBy('id'); return $categories->map(function($cat) use ($latestProducts, $products) { $pid = $latestProducts[$cat->id]->pid ?? null; $product = $pid ? $products[$pid] : null; $image = $product && $product->images->first() ? $product->images->first()->url : null; return [ 'name' => $cat->name, 'slug' => $cat->slug, 'products_count' => $cat->products_count, 'image' => $image, ]; })->values()->all(); })); } @endphp @stack('head') @hasSection('breadcrumb') @endif
@yield('content')

{{ __('BE THE FIRST TO KNOW') }}

{{ __('Get the Latest Updates') }}

{{ __('Subscribe to hear about the latest collections, exclusive promotions, and more.') }}

{{-- QUICK ADD MODAL --}}
{{ __('Customer Service') }}
{{ __('Can we help you?') }}
{{ __('Chat our WhatsApp, quick response!') }}
@stack('scripts')