mercredi 27 mars 2019

If statement not presenting the else result

The else section of my code is not being displayed in my laravel blade. I need to get the else section of the statement to show. currently, that button is missing when the if statement is false.

@auth

@if(optional($quote->userLike))

@foreach($quote->userLike as $like)

@if($like->pivot->user_id == $id) //passing user  id from controller here

<li class="list-inline-item">

<form  method="POST" action="" class="likequote">

@csrf

<input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value=''>

<button type="submit" class="btn btn-danger shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>

                                        </form>                                 
</li>   

@endif

@endforeach 

 @else

<li class="list-inline-item">

<form  method="POST" action="" class="likequote">

@csrf

<input type="hidden" class="form-control col-md-4" name="likequote" id="likequote" value=''>

<button type="submit" class="btn btn-primary shadow-lg " id="savelike"><i class="fas fa-heart"></button></i>

</form> 

</li>

 @endif 

 @endauth



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

Aucun commentaire:

Enregistrer un commentaire