I bet you have a headache when you need to mark some menu item as active. Is there any good way to solve this? Yes, there is – route attributes.

What is route attributes? Standard route attributes are like “prefix”, “namespace”, “as”, “uses” and others, for example:

Route::group(['prefix' => 'cities', 'as' => 'cities.'], function () {
    // Routes goes here...
});

Route::group(['prefix' => 'cities', 'as' => 'cities.'], function () {
    // Routes goes here...
});

As you can see route group has attributes (prefix, as), this routing feature enables us to add our custom route attributes like “_active_menu”.