Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Route parameters? #21

Closed
m1r0 opened this issue Nov 4, 2015 · 3 comments
Closed

Route parameters? #21

m1r0 opened this issue Nov 4, 2015 · 3 comments

Comments

@m1r0
Copy link

m1r0 commented Nov 4, 2015

I think it would be a good idea to include the route parameters and not only the route name.

Lets say we need to set an active class for the route admin/product-types/{product_types}/categories.

We can do something like (not a very good example but hopefully you get the point):
Active::route(['admin.product-types.categories.index' => [$product_type->id]])

@mozmorris
Copy link

@m1r0 Agreed.

For now, this should do what you want:

Active::pattern(
    ltrim(route('pages.show', $page->slug, false), '/')
);

@letrunghieu
Copy link
Owner

I released a minor update for the 2.x version. Your can see the release note.

In your case, I suggest using this expression to set the active class when the current route is admin.product-types.categories.index and the value of the product_types parameter is 1:

Active::routeParam('admin.product-types.categories.index', ['product_types' => 1])

I also rewritten the package and release it as a new major version, the 3.0.0. You can see the new documentation with new API in the master branch.

@m1r0
Copy link
Author

m1r0 commented Nov 28, 2015

@letrunghieu Thanks.

@m1r0 m1r0 closed this as completed Nov 28, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants