I find Laravel
an interesting framework. The functionality of the view is excellent, for simplifying the syntax of a foreach
or if
for example.
But one thing I did not understand is: Why does unless
?
Why use @unless
if you can simply make a @if(! $expressao)
?
What are the benefits of Blade accepting a @unless
?
Is there a case that is more beneficial to use than a% with negation?
Example:
@unless(Auth::user()->admin)
<div>Você não é administrador</div>
@endunless
{{-- aqui é menos código, não acham? --}}
@if(!Auth::user()->admin)
<div>Você não é administrador</div>
@endif