askedio/laravel5-rbac

Laravel 5.2 RBAC

dev-master 2016-02-28 17:24 UTC

README

User Roles & Permissions for Laravel 5.2

Overview

This Package glues together laravel-permission and laravel-authorize to be one package giving you all the features and a simple install command to easily get started.

More details here:

Installation

Install with composer

composer require askedio/laravel5-rbac:dev-master

Add to Providers array in config/app.php

'providers' => [
   Askedio\Laravel5RBAC\Providers\GenericServiceProvider::class,
   ...

Change your config/auth.php providers->users->model

    'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model' => Askedio\Laravel5RBAC\User::class,
        ],
        ...

Set up auth views and migrations

php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="migrations"
php artisan make:auth
php artisan migrate 

Install the role and user

php artisan user:create

Serv

php artisan serv

Use in routes

Route::get('dashboard', [
   'middleware'=> ['web','can:admin'],
   'uses' => 'HomeController@index',
]);