filipac/menu-active-check

30
Install
composer require filipac/menu-active-check
Latest Version:1.2.2
PHP:>=5.4.0
Last Updated:Feb 24, 2015
Links: GitHub  ·  Packagist
Maintainer: filipac

I had the following scenario: In a bootstrap admin theme I wanted the items in the Menu to pe marked as ACTIVE if I was on a certain controller. I had to write a lot of code everytime so i made a blade tag for quick access to the rule. Example how to use:

<li class="{@checkActive Dashboard|active}">
                      <a href="{{URL::to('/admin')}}"  >
                        <i class="fa fa-dashboard icon">
                          <b class="bg-danger"></b>
                        </i>
                        <span>@lang('admin.menu.dashboard')
                        </span>
                      </a>
                    </li>

Explanation: if the current controller is DashboardController the script will echo "active" so that the menu highlights. You can replace active with any class you want to add to the active menu items. This is a quick and rough package so if you want to make impovements, fork commit & merge request.

I wanted to have this for further Laravel projects.

Installation: Add "filipac/menu-active-check": "~1.0" to the require section of composer.json Run composer update In /app/config/app.php add the following to the end of providers array

'Filipac\MenuActiveCheck\MenuActiveCheckServiceProvider',

You are done, now you can use {@checkActive ControllerName|css-active-class} in your blade files!

Related Packages

reliese/laravel

Reliese Components for Laravel Framework code generation.

3,954,390 1,705
php-tmdb/laravel

Laravel Package for TMDB ( The Movie Database ) API. Provides easy access to the...

53,312 160
laravel-ja/laravel

The Laravel Framework.

5,667 17
kavenegar/laravel

laravel 4 and 5 kavenegar integration

366,462 86
laravel/laravel

The skeleton application for the Laravel framework.

64,738,171 84,935