Reputation: 12559
Is there a standard Laravel way to check if a named route is part of a resource?
For instance, in a Blade template I can do:
@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
Wondering if I've glossed over some standard way of doing it or if this is it.
Upvotes: 1
Views: 383