Tuesday, May 23, 2017

How can I add operator ternary in class on the view laravel blade?

I try like this :

@for($i = 0; $i < 5; $i++) 
...
    <div class="image ($i==0) ? 'image-main' : ''">
...
@endfor

But it does not work.

It seems the way of writing is incorrect.

How can I solve this problem?



via Trending News

Advertisement