@php use Illuminate\Support\Str; $gjsProductCatalog = \App\Models\Product::where('status', 1) ->where(fn ($q) => \App\Services\ThemeCatalogService::scopeProducts($q)) ->orderByDesc('is_trending') ->orderByDesc('is_popular') ->orderBy('name') ->get(['id', 'name', 'slug', 'price', 'sale_price', 'thumbnail']) ->map(function ($p) { $price = (float) $p->price; $sale = $p->sale_price ? (float) $p->sale_price : null; return [ 'id' => $p->id, 'name' => $p->name, 'slug' => $p->slug, 'price' => $price, 'current_price' => $sale && $sale < $price ? $sale : $price, 'thumbnail' => $p->thumbnail ? asset($p->thumbnail) : null, ]; }) ->values(); $comboOfferCount = \App\Models\Product::where('status', 1) ->where(fn ($q) => \App\Services\ThemeCatalogService::scopeProducts($q)) ->comboOffers()->count(); $categoryAliasMap = [ 'skin care' => 'skin-care', 'hair care' => 'hair-care', 'body care' => 'face-pack', 'herbal products' => 'neem-products', 'herbal' => 'herbal-soap', 'neem' => 'neem-products', 'organic oil' => 'organic-oils', 'face pack' => 'face-pack', 'soap' => 'herbal-soap', ]; $gjsCategories = \App\Models\Category::withCount(['products as products_count' => fn ($q) => $q->where('status', 1)]) ->whereNull('parent_id') ->where('status', 1) ->where(fn ($q) => \App\Services\ThemeCatalogService::applyThemeScope($q)) ->orderBy('sort_order') ->get(['id', 'name', 'slug']) ->map(function ($cat) use ($categoryAliasMap) { $aliases = collect([ Str::lower($cat->name), str_replace('-', ' ', $cat->slug), $cat->slug, ]); foreach ($categoryAliasMap as $alias => $slug) { if ($slug === $cat->slug) { $aliases->push($alias); } } return [ 'id' => $cat->id, 'name' => $cat->name, 'slug' => $cat->slug, 'url' => route('frontend.category', $cat->slug), 'count' => (int) $cat->products_count, 'aliases' => $aliases->map(fn ($v) => Str::lower(trim($v)))->filter()->unique()->values()->all(), ]; }) ->values(); @endphp @if(!empty(trim($setting->homepage_css ?? ''))) @endif
{!! $setting->homepage_content !!}