filipac / menu-active-check by filipac

29
0
2
Package Data
Maintainer Username: filipac
Maintainer Contact: hello@filipac.net (filipac)
Package Create Date: 2014-08-30
Package Last Update: 2015-02-24
Language: PHP
License: Unknown
Last Refreshed: 2024-11-18 03:03:47
Package Statistics
Total Downloads: 29
Monthly Downloads: 1
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

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!