Level 1
Jun 4, 2020
3
Level 2
Blade - Conditional does not work with internal parentheses.
Hello I want to make an alert appear on all pages except some and only if the cart is not empty ...
@if(!\Cart::isEmpty() && (Request::path()!='checkout' || Request::path()!='login' || Request::path()!='register'))
<div class="alert alert-warning mb-0 text-center" role="alert">
Tienes un pedido pendiente. <a href="{{route('checkout.index')}}" class="alert-link">Finalizar pedido</a>
</div>
@endif
I try to do this but I have no results ... Can Blade do internal parentheses inside a codicional?
Thank you.
Level 2
I solved it by doing all ANDs, I hadn't really thought of it that way, but I tried and it worked.
@if(!\Cart::isEmpty() and Request::path()!="checkout" and Request::path()!="login" and Request::path()!="register")
<div class="alert alert-warning mb-0 text-center" role="alert">
Tienes un pedido pendiente. <a href="{{route('checkout.index')}}" class="alert-link">Finalizar pedido</a>
</div>
@endif
Thanks for your time
Please or to participate in this conversation.