Recent Topics

The New Carousel for categories image & name not working ???



  • i try to add bootstrap carousel in homepage for categories but it is not working why???
    this my code:
    @php
    $categories = [];

    foreach (app('Webkul\Category\Repositories\CategoryRepository')->getVisibleCategoryTree(core()->getCurrentChannel()->root_category_id) as $category) {
        if ($category->slug)
        array_push($categories, $category);
    }
    

    @endphp

        <div id="demo2x" class="carousel slide" data-ride="carousel">
    
            <!-- Indicators -->
            <ul class="carousel-indicators">
              <li data-target="#demo2x" data-slide-to="0" class="active"></li>
              <li data-target="#demo2x" data-slide-to="1"></li>
              <li data-target="#demo2x" data-slide-to="2"></li>
            </ul>
    
            <!-- The slideshow -->
            <div class="carousel-inner">
                @foreach($categories as $category_data)
                <div class="carousel-item">
                    <img src="{{ asset('/storage/' . $category_data->image) }}" >
                  </div>
            @endforeach
    
    
            </div>
    
            <!-- Left and right controls -->
            <a class="carousel-control-prev" href="#demo2x" data-slide="prev">
              <span class="carousel-control-prev-icon"></span>
            </a>
            <a class="carousel-control-next" href="#demo2x" data-slide="next">
              <span class="carousel-control-next-icon"></span>
            </a>
    
          </div>


  • What error are you getting?


Log in to reply