mardi 28 mai 2019

Can I use @else/@elseif within @unless in Laravel blade?

I just found out about using @unless instead of if(!...) so I changed some of my clauses.
But I just realized that I had an if-else-statement, so I only changed it from this:

@if (!empty($data['note']))
  <p></p>
@else
  <p>no information given</p>
@endif

to this:

@unless (empty($data['note']))
  <p></p>
@else
  <p>no information given</p>
@endunless

But it didn't change anything and seems working correctly.

Is it okay/normal to use @elseand @elseif within @unless-statement?

Aucun commentaire:

Enregistrer un commentaire