Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

user224564's avatar

Change dynamic div class.

Hello, i have a foreach to show the object form the panel of my website, till here i am ok. Now i want to check if the category with id=6 have more than 3 prodoct to change div class to col-md-3 only for this id.My view of objects and categories in dynamic. '''

 <div class="container">
                    @foreach($dishes_and_category['dishes'] as $dish)
                        <div class="col-md-4 col-sm-6" id="div1">
                            <label>
                                <input type="radio"
                                       @if($dishes_and_category['id_category'] == 6) disabled @endif name="{{$dishes_and_category['id_category']}}" value="{{$dish->id}}" />
                                <img src="http:///dishes/{{$dish->image}}" style="border-radius: 50%;height: 250px;width: 100%">
                                <p style="text-align: center; font-weight: bold" class="text-uppercase">{{$dish->name}}</p>
                            </label>
                        </div>
                    @endforeach
                </div>

'''

0 likes
1 reply

Please or to participate in this conversation.