Remove @include depending on the route

后端 未结 2 1324
没有蜡笔的小新
没有蜡笔的小新 2021-01-24 16:20

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

2条回答
  •  甜味超标
    2021-01-24 16:49

    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
    

提交回复
热议问题