papia91
1 month ago

Show block via if else condition

Posted 1 month ago by papia91

If $block->user_username data empty show block button else run another if and else condition. But In foreach loop else not working @else Block2 Please anyone help me. Anyone know any other condition to do this things.

@else Block2 @endif this else condition stuck only if condition is working. if this @if(Auth::user()->name == $block->user_username && $user->username == $block->block_username) condition is false code is not showing else condition.

 @foreach($blocked as $block)    
                   @if(empty($block->user_username ))
                     <a href="#0" class="cd-popup-trigger">Block1</a>

                   @else
                        @if(Auth::user()->username == $block->user_username and $user->username == $block->block_username)
                         <a href="#0" class="cd-popup-trigger">Unblock</a>
                         @else
                            <a href="#0" class="cd-popup-trigger">Block2</a>
                        @endif
                    @endif
            @endforeach  

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