dev-master
9999999-dev http://github.com/digithis/activehelperActive helper is a simple active state system for your links in laravel 4
MIT
The Requires
- php >=5.3.0
- illuminate/support 4.*
by digithis
laravel laravel 4 active links
Active helper is a simple active state system for your links in laravel 4
active helper is a simple active state system for your links in laravel 4, (*1)
Add the following line in your composer.json
, (*2)
"digithis/activehelper": "dev-master"
Then run composer update
, (*3)
In app/config.app.php
, add the following line to the providers
array, (*4)
'Digithis\Activehelper\ActivehelperServiceProvider',
In the aliases
array, add the following line, (*5)
'Active' => 'Digithis\Activehelper\ActiveFacade',
Create a link and its current state :, (*6)
echo Active::link('users', URL::to('users'), 'Show all users');
This means that if the current request is users
, class for link is .active
, (*7)
Add several more routes as a first parameter :, (*8)
echo Active::link(array('users', 'user/add', 'user/edit'), URL::to('users'), 'Show all users');
Use *
as a pattern or exclude routes with not:
:, (*9)
echo Active::link(array('user*','not:user/edit'), URL::to('users'), 'Show all users');
This means that if the request begins with user
but is not user/edit
, class for link is .active
, (*10)
Set your own attributes if you wish:, (*11)
echo Active::link(array('group*','not:groups*'), URL::to('group'), 'Show group', array('id' => 'mycustomid'));
You can also only get the current state (boolean), (*12)
$state = Active::is('page*','not:pages*');
And return the active class if the routes are matched, (*13)
Active::classes('page*', 'not:pages*'); // Returns 'active'
Active helper is a simple active state system for your links in laravel 4
MIT
laravel laravel 4 active links