2017 © Pedro Peláez
 

library permission

Extend toddish verify permission to easy setting for Laravel 4.

image

casper/permission

Extend toddish verify permission to easy setting for Laravel 4.

  • Tuesday, February 11, 2014
  • by casperlaitw
  • Repository
  • 1 Watchers
  • 0 Stars
  • 47 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Easy Permission Verify - Laravel 4


It's a extend toddish verify permission to easy setting for Laravel 4.

  • a file organize all permission defined
  • Licensed under the MIT license

Important

This packages depends on toddish/veirfy. You should configurate toddish/verify., (*1)

Installation

Add verify to your composer.json file:, (*2)

"require": {
    "casper/permission": "dev-master"
}

Now, run a composer update on the command line from the root of your project:, (*3)

composer update

Registering the Package

Add the service provider to your config in app/config/app.php:, (*4)

'providers' => array(
    'Casper\Permission\PermissionServiceProvider'
),

Set Package Aliases

Add the service Aliases to your config in app/config/app.php:, (*5)

'aliases' => array(
    'Permission'      => 'Casper\Permission\PermissionFacade'
),

Usage

1. Define permissions in app/permission.php

Now, create a file called app/permission.php. The file will be loaded automatically., (*6)

// 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:, (*7)

  • $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.

2. Run Verify

In you want to run verify place to add code:, (*8)

    Permission::verify(Request::url());

Example: I want to verify after checking admin logged-in. So I place code in app/filters.php, (*9)

Route::filter('auth.admin', function(){
    if(Auth::guest()) return Redirect::route('admin.login');
    // Permission Verify
    Permission::verify();
});

The Versions

11/02 2014

dev-master

9999999-dev https://github.com/CasperLaiTW/laravel-permission-packages

Extend toddish verify permission to easy setting for Laravel 4.

  Sources   Download

MIT

The Requires

 

by Casper Lai

laravel permissions verify