lundi 13 février 2017

If statement inside a foreach loop

@foreach ($image as $image)

        <div class="col-md-4">

        @if ($image->current_step == 'step'.$loop->iteration AND $image->isCompleted == '1')
            <div class="panel panel-success">

        @elseif ($image->current_step == 'step'.$loop->first OR $image->current_step == 'step'.$loop->index AND $image->isCompleted == '1')
            <div class="panel panel-default">

        @elseif ($image->current_step == 'step'.$loop->iteration AND $image->isCompleted == '0')
            <div class="panel panel-danger">


        @endif
@endforeach

I've created a loop to generate a number of panels, however I want the panels to be styled differently based off the correct if statements.

It seems to be getting stuck on the second if statement whenever it hits that part to ask if the previous steps condition has been met.

If anyone can point me in the general direction or another way I should be going.

Thanks



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2ko1nHb
via IFTTT

Aucun commentaire:

Enregistrer un commentaire