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

How to check Request::is('/new/*') in Blade view in Laravel 6

如何在 Laravel 6 的 Blade 视图中检查 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