Laravel 5.2 检测路由是否是资源的一部分

Laravel 5.2 检测路由是否是资源的一部分,laravel-5.2,laravel-routing,Laravel 5.2,Laravel Routing,是否有标准的Laravel方法来检查命名路由是否是资源的一部分 例如,在刀片模板中,我可以执行以下操作: @if(strpos(Route::currentRouteName(), 'posts') === 0) Yep, you're viewing a post.index, post.edit, post.preview, etc. @else Nothing to do with a post. @if 想知道我是否已经掩盖了一些标准的方法,或者这就是它。我刚刚发现

是否有标准的Laravel方法来检查命名路由是否是资源的一部分

例如,在刀片模板中,我可以执行以下操作:

@if(strpos(Route::currentRouteName(), 'posts') === 0)
     Yep, you're viewing a post.index, post.edit, post.preview, etc.
@else
     Nothing to do with a post.
@if

想知道我是否已经掩盖了一些标准的方法,或者这就是它。

我刚刚发现:

Route::is('posts.*')

我刚想出来:

Route::is('posts.*')