I need to check 2 routes, and if one is true, add some content
@if (Route::current()->uri() != '/' || Route::current()->uri() != 'login')<div>add some content some contnt </div> @endif
I have tried with '||' and 'OR' and 'or'. I have also tried with Request::path()
, which works only when checking 1 route
@if (Route::current()->uri() != '/') <div>add some content some contnt </div> @endif
If I try 2 routes it doesn't seem to work
You can use the built in methods to check for a route name or pattern.
See Route::is()
or Route::currentRouteNamed()
For example:
Route::get('users', 'Controller..')->name('users.index');
Route::get('users/{id}', 'Controller..')->name('users.show');
Assuming you are in the following path : users/1
@if(Route::is('users.show') )
// true
@endif
@if(Route::is('users') )
// false
@endif
@if(Route::is('users.*') )
// true
@endif
So in your example try @if(Route::is('home') or Route::is('login'))..@endif
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With