Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Switching styles in CSS, under the specified conditions laravel

I need to specify my styles under certain conditions

<div class="flex-container">
                @foreach($topServers as $server)
                    <div class="flex-item">
                        <div class="row">
                            @foreach($guilds as $guild)
                                @if($server->id == $guild->id)
                                    <img class="col-md-auto avatar" src="..." alt="">
                                @endif
                            @endforeach
                        </div>
                    </div>
                @endforeach
            </div>

Provided that $server->premium >= 1, you need to specify the "border-color:gold" styles in the div class="flex-item"

And I absolutely do not understand how to implement it, thank you in advance for your help

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Just use a ternary to add a style.

<div class="flex-item" {{ $server->premium >= 1 ? 'style="border-color:gold"' : '' }}>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading