3
I think the Laravel
an interesting framework. The features of the view are excellent, regarding the simplification of the syntax of a foreach
or if
for example.
But still one thing I don’t understand is: Why the unless
?
Why use the @unless
if you can just make a @if(! $expressao)
?
What are the benefits of Blade accepting a @unless
?
Is there any case that it is more beneficial to use it than a @if
in denial?
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
syntax Uggar only =D Laravel is full of it
– gmsantos
Honestly, for me, it was not easy to read. There was a replacement of a known operator (!) by a less common (unless) method. In my opinion, a function has to bring more than just better "reading", should bring performance benefits (lambda, for example), simplify declarations by reducing the amount of code (foreach, warn...) and so on.
– Rafael Pizao