gongyuwen/laravel-acl

acl plugin for laravel

1.0.0 2018-06-15 03:14 UTC

This package is not auto-updated.

Last update: 2025-02-02 05:33:35 UTC


README

ACL Plugins for Laravel

Installation

Use [Composer] to install the package:

$ composer require gongyuwen/laravel-acl

Usage

1.register command

//App\Console\Kernel.php

protected $commands = [    
    \LaravelAcl\Console\MakeAclCommand::class
];

2.use command

$ php artisan make:acl

3.edit config/acl.php

/**
* Example:
* URL: admin/list
* ACTION: Administrator\DefaultController@index
* METHOD: get,post
* ALLOW: member, admin
* DENY: ACL_NO_ROLE
* MIDDLEWARE: acl
* ROUTE NAME: adminlist
**/
return [
    'menus' => [
        'admin' => [
            'namespace' => 'Administrator',
            'action'    => 'DefaultController@index',
            'uri'       => 'list',
            'method'    => 'get,post',
            'allow'     => 'member, admin',
            'deny'      => 'ACL_NO_ROLE',            
            'middleware'=> 'acl',
            'name'      => 'adminlist'
        ]
    ]
];

Method