I have a menu partial, that includes a input search bar. But i don\'t want the search bar to be visibel on all pages, only for two specific uri´s. Is there a way to remove that
Use is()
method:
@if (request()->is($url))
@include('partials._search')
@endif
Or if you know route name:
@if (request()->route()->getName() === $routeName)
@include('partials._search')
@endif
To retrieve URL from the blade template, use {{ Request::url() }}
.
This will output something like http://example.dev/articles
To retrieve path, use {{ Request::path() }}
Using the above example, this will output articles.