Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Certain routes do not work #14

Open
nikolayynayydenov opened this issue Aug 9, 2018 · 2 comments
Open

Certain routes do not work #14

nikolayynayydenov opened this issue Aug 9, 2018 · 2 comments

Comments

@nikolayynayydenov
Copy link

nikolayynayydenov commented Aug 9, 2018

I am using lumen framework and I noticed multiple word named routes do not work with this package.

<a href="{{route('article.create')}}" class="{{active(['article.create'], 'active')}}">
    New Article
</a>
$router->get('/article/create', [
    'as' => 'article.create',
    'uses' => 'ArticleController@create'
]);   

When I invoke is_active('article.create') in ArticleController@create it returns false. If I change the route to just "/article" and change the name from "article.create" to "article", it works.

The same problem occurs on "/".

@dwightwatson
Copy link
Owner

Thanks for reporting this. Just to clarify, you have a route named article.create and is_active won’t recognise it? If you could describe the exact problem you are seeing on ‘/‘ too.

Lumen uses a different router to Laravel but I would have through the route matching worked the same. Once I have your two broken examples I’ll try find out what is going on.

@nikolayynayydenov
Copy link
Author

Yes article.create does not seem to get recognized by is_active (it returns false).

As for "/":

<li><a href="{{route('home')}}" class="{{active(['home'], 'active')}}">Home</a></li>

$router->get('/', [
    'as' => 'home',
    'uses' => 'HomePageController@index'
]);

I named it "home" and the route works (pages switch on click) but is_active() returns false. The same happens when I change the name of the route to an empty string ""

<li><a href="{{route('')}}" class="{{active([''], 'active')}}">Home</a></li>

$router->get('/', [
    'as' => '',
    'uses' => 'HomePageController@index'
]);

Single word routes work though. For example a route /foo named "foo" works perfectly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants