6 months ago

Blade help

Posted 6 months ago by madsynn

I have a loop of five variables i need to return a value from each. but i am not getting the last part and cannot figure out why. Here is what i have so far.

@php $z = 'B'; @endphp
 @foreach($sss as $smart)
        @php $z++;  @endphp

        @if($smart->server_exists == true && $smart->is_setup == false && $smart->ready_to_receive_conf == false && $smart->configured== false)
        class {{ $z }} serverexists <br>
        @elseif($smart->server_exists == true && $smart->is_setup == true && $smart->ready_to_receive_conf == false && $smart->configured== false)
        class {{ $z }} hascaipy <br>
        @elseif($smart->server_exists == true && $smart->is_setup == true && $smart->ready_to_receive_conf == true && $smart->configured== false)
        class {{ $z }} needsconf <br>
        @elseif($smart->server_exists == true && $smart->is_setup == true && $smart->ready_to_receive_conf == true && $smart->configured== true)
                @case($ss->status->id == 1)
                case1 {{ $z }} running <br>

                @case($ss->status->id == 2)
                case2 {{ $z }} notrunning <br>

                @case($ss->status->id == 3)
                case3 {{ $z }} stopped <br>
                default {{ $z }} configured <br>
        class {{ $z }} before <br>


Here is my output it all works fine until i get to the switch. I have also tried doing all of it as elseif but have the same problem it just returns the first or second depending on what i try.

class C serverexists 
class D hascaipy 
class E needsconf 
case2 F notrunning 
case2 G notrunning 
case2 H notrunning 
case2 I notrunning 
case2 J notrunning 
class K before 
class L before 

Please sign in or create an account to participate in this conversation.