导航php菜单到bootstrap

im new here and im still studying about php and bootstrap, for now im trying to use the col-sm-3 per category and its sub menu. i posted the code under and i having trouble because im new about his coding. can someone show me to convert its li to col-sm-3 so that i could have a good menu?

this is my current menu

and i want my menu becomes like this

and this is what i want if someone help me :D

<ul class="main-navigation">
    
    <?php foreach ($categories as $category_1) { ?>
        <li>
            <a href="<?php echo $category_1['href']; ?>"><?php echo $category_1['name']; ?></a>
             <?php if ($category_1['children']) { ?>
               <?php $i = count($category_1['children']); ?>
                    
                    <div class="categorybg">
                         <div class="categoryinner">
                            
                                <ul>
                                <?php $i=1; ?>
                                <?php foreach ($category_1['children'] as $category_2) { ?>
                            
                                <li class="categorycolumn"><b><a class="submenu1" href="<?php echo $category_2['href']; ?>"><?php echo $category_2['name']; ?></a></b>
                                
                                  <?php if($category_2['children']) { ?>
                                    <?php $j = count($category_2['children']); ?>
                                    <?php if($j<=10) { ?>
                                    
                                    <div class="cate_inner_bg">
                                      <ul>
                                         <?php foreach ($category_2['children'] as $category_3) { ?>
                                         <li><a class="submenu2" href="<?php echo $category_3['href']; ?>"><?php echo $category_3['name']; ?></a></li>
                                         <?php } ?>
                                      </ul>
                                    </div>
                                
                                    <?php } else { ?>
                                    
                                    <div>
                                      <ul>
                                      <?php $j=0; ?>
                                         <?php foreach ($category_2['children'] as $category_3) { ?>
                                         <li><a class="submenu2" href="<?php echo $category_3['href']; ?>"><?php echo $category_3['name']; ?></a></li>
                                         <?php if (++$j == 10) ?>
                                         <?php } ?>
                                         <li><a class="submenu2" href="<?php echo $category_2['href']; ?>">More....</a></li>
                                      </ul>
                                    </div>
                                    <?php } ?>
                                    
                                </li>
                                <?php } ?>
                            
                                <?php } ?>
                                
                                </ul>
                                
                    
        
                            
                        </div>
                    </div>
                
                <?php } ?>
            <?php } ?>
        </li>
  </ul>

</div>