Skip to content
Kodeine edited this page Feb 23, 2015 · 24 revisions

Installation

Composer

Add this to your composer.json file, in the require object:

"kodeine/laravel-acl": "dev-master"

After that, run composer install to install the package.

Register Service Provider

Add the package to your application service providers in config/app.php

'providers' => [
    
    'Illuminate\Foundation\Providers\ArtisanServiceProvider',
    'Illuminate\Auth\AuthServiceProvider',
    ...
    
    'Kodeine\Acl\AclServiceProvider',

],

Publish the package migrations to your application.

$ php artisan vendor:publish

Run migrations.

$ php artisan migrate

Configuration

Middleware Setup

Add the following to your app/Kernel.php

protected $routeMiddleware = [
    ....
    'acl' => 'App\Http\Middleware\HasPermission',
];

Model Setup

Next, add the HasRole trait to your User model:

use Kodeine\Acl\HasRole;

class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
    use Authenticatable, CanResetPassword, HasRole;
}