digithis / activehelper by digithis

Active helper is a simple active state system for your links in laravel 4
2,957
16
6
Package Data
Maintainer Username: digithis
Maintainer Contact: rolletremi@gmail.com (Digithis)
Package Create Date: 2013-08-01
Package Last Update: 2013-11-21
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-04-22 03:09:14
Package Statistics
Total Downloads: 2,957
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 16
Total Watchers: 6
Total Forks: 2
Total Open Issues: 0

##Active Helper active helper is a simple active state system for your links in laravel 4 ###How to install Add the following line in your composer.json

"digithis/activehelper": "dev-master"

Then run composer update

In app/config.app.php, add the following line to the providers array

'Digithis\Activehelper\ActivehelperServiceProvider',

In the aliases array, add the following line

'Active'  => 'Digithis\Activehelper\ActiveFacade',

###How to use Create a link and its current state :

echo Active::link('users', URL::to('users'), 'Show all users');

This means that if the current request is users, class for link is .active

Add several more routes as a first parameter :

echo Active::link(array('users', 'user/add', 'user/edit'), URL::to('users'), 'Show all users');

Use * as a pattern or exclude routes with not: :

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

Set your own attributes if you wish:

echo Active::link(array('group*','not:groups*'), URL::to('group'), 'Show group', array('id' => 'mycustomid'));

You can also only get the current state (boolean)

$state = Active::is('page*','not:pages*');

And return the active class if the routes are matched

Active::classes('page*', 'not:pages*');

// Returns 'active'