{{-- @if (setting('SUB_CAT_PRODUCT_STATUS') != 0 || setting('SUB_CAT_PRODUCT_STATUS') == '')
@if (!empty(setting('sub_cat'))) --}}

{{-- @php
    $c = 103;
@endphp --}}

    @foreach (json_decode(setting('sub_cat')) as $c)
        @php
            $cat = DB::table('sub_categories')->where('id', $c)->first();
            $productIds = DB::table('product_sub_category')
                ->where('sub_category_id', $c)
                ->get()
                ->pluck('product_id');
            $products = \App\Models\Product::whereIn('id', $productIds)->where('status', 1)->take(6)->get();
        @endphp
        @if ($cat)
            @if ($products->count() > 0)
                <div class="products">
                    <div class="container">
                        <h3 class="title"><span>{{ $cat->name }}</span> <a
                                href="{{ route('subCategory.product', $cat->slug) }}">View All</a>
                        </h3>
                        <div class="row autoplay slick-slides">
                            @forelse ($products as $product)
                                <x-product-grid-view :product="$product" classes="" />
                            @empty
                                <x-product-empty-component />
                            @endforelse

                        </div>
                    </div>
                </div>
            @endif
        @endif
    @endforeach
{{-- @endif
@endif --}}