active icon indicating copy to clipboard operation
active copied to clipboard

Active class and route with pagination

Open n-osennij opened this issue 7 years ago • 0 comments

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.

n-osennij avatar Aug 14 '18 13:08 n-osennij