convert this code to html for showing on output

  ajax, css, html, laravel, php

I have a Ajax Search and would like to show this Code ( as Html ) in function , how can I convert this code to html for showing on output.

I use PHP and Laravel.

<td style="text-align: center">
        @if(isset($category['parent_id']) && $category['parent_id'] == 0)
        <button style="width: 50%" class="btn btn-outline-secondary btn-sm">Main Category</button>
        @endif
        @if(!empty($getCategories))
            @foreach($getCategories as $cat)
                        @if(isset($category['parent_id']) && $category['parent_id'] == $cat->id)
                        <button class="btn btn-outline-secondary btn-sm">  {{$cat->category_name}}</button>
                            @endif
                            @if(!empty($cat['subCategories']))
                                @foreach($cat['subCategories'] as $subcategory)
                                    @if(isset($category['parent_id']) && $category['parent_id'] == $subcategory->id)
                                        <button  class="btn btn-outline-secondary btn-sm">{{$cat->category_name}}</button> -> <button class="btn btn-outline-secondary btn-sm">{{$subcategory->category_name}}</button>
                                    @endif
                                            @foreach($subcategory['subCategories'] as $subcategory1)
                                                @if(isset($category['parent_id']) && $category['parent_id'] == $subcategory1->id)
                                                <button class="btn btn-outline-secondary btn-sm">{{$cat->category_name}} </button> -> <button class="btn btn-outline-secondary btn-sm">  {{$subcategory->category_name}} </button> ->  <button class="btn btn-outline-secondary btn-sm ">  {{$subcategory1->category_name}} </button>
                                                @endif
                                                    @foreach($subcategory1['subCategories'] as $subcategory2)
                                                        @if(isset($category['parent_id']) && $category['parent_id'] == $subcategory2->id)
                                                            {{$cat->category_name}} -> {{$subcategory->category_name}} -> {{$subcategory1->category_name}} -> {{$subcategory2->category_name}}
                                                        @endif
                                                    @endforeach
                                            @endforeach
                                @endforeach
                            @endif
            @endforeach
        @endif

</td>

Source: Ask PHP

LEAVE A COMMENT