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

Active class and route with pagination #15

Open
n-osennij opened this issue Aug 14, 2018 · 0 comments
Open

Active class and route with pagination #15

n-osennij opened this issue Aug 14, 2018 · 0 comments

Comments

@n-osennij
Copy link

I have next menu

<div class="list-group">
    <a href="{{route('products')}}"
       class="list-group-item list-group-item-action {{ active(route('products', ['category' => null])) }}">
        All
    </a>
    @foreach(App\Category::all() as $category)
        <a class="list-group-item list-group-item-action {{ active(route('products', ['category' => $category->slug])) }}"
           href="{{route('products', ['category' => $category->slug])}}"
        >
            {{$category->name}}
        </a>
    @endforeach
</div>

This is a munu of categories. Route is next (Note - In category menu I do not use now label)

Route::get('/products/{category?}/{label?}', 'CatalogController@index')->name('products');

I show products in category with pagination. First page (without ?page= in url) is fine - munu have active class. But if there are isset ?page= in url - no active class in munu. If I add Label to url - no active class too.

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

1 participant