Reputation: 23
How do i set different states of the icon? I want it to change between a liked/not liked icon. Can i do that? I don't completely understand the syntax. The btn-success class is for the liked icon, and btn-danger is for the unliked button.
@if(Auth::check())
@if( !$unblock )
<span data-id="{{ $key->id }}" data-like="Like" data-like-active="Remove Like" title="@if(!empty($likeUser)) Remove Like @else Like @endif" class="btn btn-xs pull-left @if(!empty($likeUser)) btn-success @else btn-danger @endif btn-like likeButton @if(!empty($likeUser)) active @endif">
<i class="Like-icon"></i>
</span>
@else
Upvotes: 0
Views: 463
Reputation: 118
@if (count($records) === 1)
I have one record!
@elseif (count($records) > 1)
I have multiple records!
@else
I don't have any records!
@endif
Upvotes: 1
Reputation: 11310
You're almost right just complete the condition after @else
Here is the place to learn more about blades and templates
It is as simple like regular PHP if..else
condition
@if (Auth::check())
Authorized
@else
Nope
@endif
If you want to have additional conditions inside then
@if (Auth::check())
Authorized
//your additional conditions for authorized users
@else
Nope
@endif
Upvotes: 2