View 如何在Laravel 6的刀片视图中检查Request::is(';/new/*';)

View 如何在Laravel 6的刀片视图中检查Request::is(';/new/*';),view,laravel-blade,laravel-6,View,Laravel Blade,Laravel 6,如何在Laravel 6的刀片视图中检查Request::is('/new/*')?我在主页上没有侧边栏。但是,我想要domain.com/new/x页面上的侧栏,比如domain.com/new/231 我就是这么做的,但没用 @if(Request::is('/new/*')) @include('inc.sidebar') @endif 您正在尝试匹配路由或URL吗?你能在web.php中显示你的路线吗 @if (\Request::is('new/*')) { //

如何在Laravel 6的刀片视图中检查
Request::is('/new/*')
?我在主页上没有侧边栏。但是,我想要
domain.com/new/x
页面上的侧栏,比如
domain.com/new/231

我就是这么做的,但没用

@if(Request::is('/new/*'))
    @include('inc.sidebar')
@endif

您正在尝试匹配路由或URL吗?你能在web.php中显示你的路线吗

@if (\Request::is('new/*')) { 
    // will match URL /new/231 or /new/x
@endif
路由::get('/new/{newId}','PostController@display');
class PostController扩展控制器
{
`//single page display``公共函数显示($id){``返回视图('post');````}
}