<style>
.banner-bg {
 background: linear-gradient(0deg, blue, green 40%, red) !important;
        
}
</style>

<div id="carouselExampleSlidesOnly" class="carousel carousel-light slide" data-bs-ride="carousel">
  <div class="carousel-inner">
  <?php
     $i = 0;
     foreach($banners as $banner){
      $actives = '';
       if($i == 0) {
        $actives = 'active';
       }
     $i++;
    ?>

    <div class="carousel-item active <?php echo $actives;?>">
      <img src="<?= $this->Url->image($banner->image_path) ?>" class="d-block w-100 banner_img " alt="<?= $banner->title?>">
      <div class="carousel-caption d-md-block cp_centered ">
      <h5 class="h1 "><?= $menuDetails->name ?></h5>
      </div>
    </div>

<?php } ?>

      </div>
</div>