Reputation: 69
Im trying to pass a condition with a logical OR on blade view where I can display a div tag, Whenever either of the two conditions becomes true.
@if(\Route::current()->getName() != 'this_route' or \Route::current()->getName() != 'other_route')
<div>Display when is true</div>
@endif
OR
@if(\Route::current()->getName() != 'this_route' || \Route::current()->getName() != 'other_route')
<div>Display when is true</div>
@endif
Both above codes do not work for me
Upvotes: 1
Views: 423
Reputation: 15316
It should be &&
condition because as you said if both condition true then both parts should be executed then here you need to use and
condition.
@if(\Route::current()->getName() != 'this_route' && \Route::current()->getName() != 'other_route')
<div>Display when is true</div>
@endif
Upvotes: 1