| Package Data | |
|---|---|
| Maintainer Username: | casperlaitw |
| Maintainer Contact: | casper.lai@sleepingdesign.com (Casper Lai) |
| Package Create Date: | 2013-10-20 |
| Package Last Update: | 2014-02-11 |
| Home Page: | |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-20 15:02:48 |
| Package Statistics | |
|---|---|
| Total Downloads: | 53 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 0 |
| Total Watchers: | 1 |
| Total Forks: | 0 |
| Total Open Issues: | 0 |
This packages depends on toddish/veirfy. You should configurate toddish/verify.
Add verify to your composer.json file:
"require": {
"casper/permission": "dev-master"
}
Now, run a composer update on the command line from the root of your project:
composer update
Add the service provider to your config in app/config/app.php:
'providers' => array(
'Casper\Permission\PermissionServiceProvider'
),
Add the service Aliases to your config in app/config/app.php:
'aliases' => array(
'Permission' => 'Casper\Permission\PermissionFacade'
),
app/permission.phpNow, create a file called app/permission.php. The file will be loaded automatically.
// Permission::setPermission($route, $canUsePermissionName);
Permission::setPermission(array('admin.roles.index', 'admin.roles.show'), array('role_index', 'role_all'));
As you can see, the define include two param:
$route It's router name. It's can be array or string.$canUsePermissionName It's means can use this page's permission name. It's can be array or string.In you want to run verify place to add code:
Permission::verify(Request::url());
Example:
I want to verify after checking admin logged-in. So I place code in app/filters.php
Route::filter('auth.admin', function(){
if(Auth::guest()) return Redirect::route('admin.login');
// Permission Verify
Permission::verify();
});