Role-based Permissions for Laravel 5

Overview

ENTRUST (Laravel 5 Package)

Build Status Version License Total Downloads

SensioLabsInsight

Entrust is a succinct and flexible way to add Role-based Permissions to Laravel 5.

If you are looking for the Laravel 4 version, take a look Branch 1.0. It contains the latest entrust version for Laravel 4.

Contents

Installation

  1. In order to install Laravel 5 Entrust, just add the following to your composer.json. Then run composer update:
"zizaco/entrust": "5.2.x-dev"
  1. Open your config/app.php and add the following to the providers array:
Zizaco\Entrust\EntrustServiceProvider::class,
  1. In the same config/app.php and add the following to the aliases array:
'Entrust'   => Zizaco\Entrust\EntrustFacade::class,
  1. Run the command below to publish the package config file config/entrust.php:
php artisan vendor:publish
  1. Open your config/auth.php and add the following to it:
'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model' => Namespace\Of\Your\User\Model\User::class,
        'table' => 'users',
    ],
],
  1. If you want to use Middleware (requires Laravel 5.1 or later) you also need to add the following:
    'role' => \Zizaco\Entrust\Middleware\EntrustRole::class,
    'permission' => \Zizaco\Entrust\Middleware\EntrustPermission::class,
    'ability' => \Zizaco\Entrust\Middleware\EntrustAbility::class,

to routeMiddleware array in app/Http/Kernel.php.

Configuration

Set the property values in the config/auth.php. These values will be used by entrust to refer to the correct user table and model.

To further customize table names and model namespaces, edit the config/entrust.php.

User relation to roles

Now generate the Entrust migration:

php artisan entrust:migration

It will generate the <timestamp>_entrust_setup_tables.php migration. You may now run it with the artisan migrate command:

php artisan migrate

After the migration, four new tables will be present:

  • roles — stores role records
  • permissions — stores permission records
  • role_user — stores many-to-many relations between roles and users
  • permission_role — stores many-to-many relations between roles and permissions

Models

Role

Create a Role model inside app/models/Role.php using the following example:

<?php namespace App;

use Zizaco\Entrust\EntrustRole;

class Role extends EntrustRole
{
}

The Role model has three main attributes:

  • name — Unique name for the Role, used for looking up role information in the application layer. For example: "admin", "owner", "employee".
  • display_name — Human readable name for the Role. Not necessarily unique and optional. For example: "User Administrator", "Project Owner", "Widget Co. Employee".
  • description — A more detailed explanation of what the Role does. Also optional.

Both display_name and description are optional; their fields are nullable in the database.

Permission

Create a Permission model inside app/models/Permission.php using the following example:

<?php namespace App;

use Zizaco\Entrust\EntrustPermission;

class Permission extends EntrustPermission
{
}

The Permission model has the same three attributes as the Role:

  • name — Unique name for the permission, used for looking up permission information in the application layer. For example: "create-post", "edit-user", "post-payment", "mailing-list-subscribe".
  • display_name — Human readable name for the permission. Not necessarily unique and optional. For example "Create Posts", "Edit Users", "Post Payments", "Subscribe to mailing list".
  • description — A more detailed explanation of the Permission.

In general, it may be helpful to think of the last two attributes in the form of a sentence: "The permission display_name allows a user to description."

User

Next, use the EntrustUserTrait trait in your existing User model. For example:

<?php

use Zizaco\Entrust\Traits\EntrustUserTrait;

class User extends Eloquent
{
    use EntrustUserTrait; // add this trait to your user model

    ...
}

This will enable the relation with Role and add the following methods roles(), hasRole($name), withRole($name), can($permission), and ability($roles, $permissions, $options) within your User model.

Don't forget to dump composer autoload

composer dump-autoload

And you are ready to go.

Soft Deleting

The default migration takes advantage of onDelete('cascade') clauses within the pivot tables to remove relations when a parent record is deleted. If for some reason you cannot use cascading deletes in your database, the EntrustRole and EntrustPermission classes, and the HasRole trait include event listeners to manually delete records in relevant pivot tables. In the interest of not accidentally deleting data, the event listeners will not delete pivot data if the model uses soft deleting. However, due to limitations in Laravel's event listeners, there is no way to distinguish between a call to delete() versus a call to forceDelete(). For this reason, before you force delete a model, you must manually delete any of the relationship data (unless your pivot tables uses cascading deletes). For example:

$role = Role::findOrFail(1); // Pull back a given role

// Regular Delete
$role->delete(); // This will work no matter what

// Force Delete
$role->users()->sync([]); // Delete relationship data
$role->perms()->sync([]); // Delete relationship data

$role->forceDelete(); // Now force delete will work regardless of whether the pivot table has cascading delete

Usage

Concepts

Let's start by creating the following Roles and Permissions:

$owner = new Role();
$owner->name         = 'owner';
$owner->display_name = 'Project Owner'; // optional
$owner->description  = 'User is the owner of a given project'; // optional
$owner->save();

$admin = new Role();
$admin->name         = 'admin';
$admin->display_name = 'User Administrator'; // optional
$admin->description  = 'User is allowed to manage and edit other users'; // optional
$admin->save();

Next, with both roles created let's assign them to the users. Thanks to the HasRole trait this is as easy as:

$user = User::where('username', '=', 'michele')->first();

// role attach alias
$user->attachRole($admin); // parameter can be an Role object, array, or id

// or eloquent's original technique
$user->roles()->attach($admin->id); // id only

Now we just need to add permissions to those Roles:

$createPost = new Permission();
$createPost->name         = 'create-post';
$createPost->display_name = 'Create Posts'; // optional
// Allow a user to...
$createPost->description  = 'create new blog posts'; // optional
$createPost->save();

$editUser = new Permission();
$editUser->name         = 'edit-user';
$editUser->display_name = 'Edit Users'; // optional
// Allow a user to...
$editUser->description  = 'edit existing users'; // optional
$editUser->save();

$admin->attachPermission($createPost);
// equivalent to $admin->perms()->sync(array($createPost->id));

$owner->attachPermissions(array($createPost, $editUser));
// equivalent to $owner->perms()->sync(array($createPost->id, $editUser->id));

Checking for Roles & Permissions

Now we can check for roles and permissions simply by doing:

$user->hasRole('owner');   // false
$user->hasRole('admin');   // true
$user->can('edit-user');   // false
$user->can('create-post'); // true

Both hasRole() and can() can receive an array of roles & permissions to check:

$user->hasRole(['owner', 'admin']);       // true
$user->can(['edit-user', 'create-post']); // true

By default, if any of the roles or permissions are present for a user then the method will return true. Passing true as a second parameter instructs the method to require all of the items:

$user->hasRole(['owner', 'admin']);             // true
$user->hasRole(['owner', 'admin'], true);       // false, user does not have admin role
$user->can(['edit-user', 'create-post']);       // true
$user->can(['edit-user', 'create-post'], true); // false, user does not have edit-user permission

You can have as many Roles as you want for each User and vice versa.

The Entrust class has shortcuts to both can() and hasRole() for the currently logged in user:

Entrust::hasRole('role-name');
Entrust::can('permission-name');

// is identical to

Auth::user()->hasRole('role-name');
Auth::user()->can('permission-name');

You can also use placeholders (wildcards) to check any matching permission by doing:

// match any admin permission
$user->can("admin.*"); // true

// match any permission about users
$user->can("*_users"); // true

To filter users according a specific role, you may use withRole() scope, for example to retrieve all admins:

$admins = User::withRole('admin')->get();
// or maybe with a relationsship
$company->users()->withRole('admin')->get();

User ability

More advanced checking can be done using the awesome ability function. It takes in three parameters (roles, permissions, options):

  • roles is a set of roles to check.
  • permissions is a set of permissions to check.

Either of the roles or permissions variable can be a comma separated string or array:

$user->ability(array('admin', 'owner'), array('create-post', 'edit-user'));

// or

$user->ability('admin,owner', 'create-post,edit-user');

This will check whether the user has any of the provided roles and permissions. In this case it will return true since the user is an admin and has the create-post permission.

The third parameter is an options array:

$options = array(
    'validate_all' => true | false (Default: false),
    'return_type'  => boolean | array | both (Default: boolean)
);
  • validate_all is a boolean flag to set whether to check all the values for true, or to return true if at least one role or permission is matched.
  • return_type specifies whether to return a boolean, array of checked values, or both in an array.

Here is an example output:

$options = array(
    'validate_all' => true,
    'return_type' => 'both'
);

list($validate, $allValidations) = $user->ability(
    array('admin', 'owner'),
    array('create-post', 'edit-user'),
    $options
);

var_dump($validate);
// bool(false)

var_dump($allValidations);
// array(4) {
//     ['role'] => bool(true)
//     ['role_2'] => bool(false)
//     ['create-post'] => bool(true)
//     ['edit-user'] => bool(false)
// }

The Entrust class has a shortcut to ability() for the currently logged in user:

Entrust::ability('admin,owner', 'create-post,edit-user');

// is identical to

Auth::user()->ability('admin,owner', 'create-post,edit-user');

Blade templates

Three directives are available for use within your Blade templates. What you give as the directive arguments will be directly passed to the corresponding Entrust function.

@role('admin')
    <p>This is visible to users with the admin role. Gets translated to 
    \Entrust::role('admin')</p>
@endrole

@permission('manage-admins')
    <p>This is visible to users with the given permissions. Gets translated to 
    \Entrust::can('manage-admins'). The @can directive is already taken by core 
    laravel authorization package, hence the @permission directive instead.</p>
@endpermission

@ability('admin,owner', 'create-post,edit-user')
    <p>This is visible to users with the given abilities. Gets translated to 
    \Entrust::ability('admin,owner', 'create-post,edit-user')</p>
@endability

Middleware

You can use a middleware to filter routes and route groups by permission or role

Route::group(['prefix' => 'admin', 'middleware' => ['role:admin']], function() {
    Route::get('/', 'AdminController@welcome');
    Route::get('/manage', ['middleware' => ['permission:manage-admins'], 'uses' => 'AdminController@manageAdmins']);
});

It is possible to use pipe symbol as OR operator:

'middleware' => ['role:admin|root']

To emulate AND functionality just use multiple instances of middleware

'middleware' => ['role:owner', 'role:writer']

For more complex situations use ability middleware which accepts 3 parameters: roles, permissions, validate_all

'middleware' => ['ability:admin|owner,create-post|edit-user,true']

Short syntax route filter

To filter a route by permission or role you can call the following in your app/Http/routes.php:

// only users with roles that have the 'manage_posts' permission will be able to access any route within admin/post
Entrust::routeNeedsPermission('admin/post*', 'create-post');

// only owners will have access to routes within admin/advanced
Entrust::routeNeedsRole('admin/advanced*', 'owner');

// optionally the second parameter can be an array of permissions or roles
// user would need to match all roles or permissions for that route
Entrust::routeNeedsPermission('admin/post*', array('create-post', 'edit-comment'));
Entrust::routeNeedsRole('admin/advanced*', array('owner','writer'));

Both of these methods accept a third parameter. If the third parameter is null then the return of a prohibited access will be App::abort(403), otherwise the third parameter will be returned. So you can use it like:

Entrust::routeNeedsRole('admin/advanced*', 'owner', Redirect::to('/home'));

Furthermore both of these methods accept a fourth parameter. It defaults to true and checks all roles/permissions given. If you set it to false, the function will only fail if all roles/permissions fail for that user. Useful for admin applications where you want to allow access for multiple groups.

// if a user has 'create-post', 'edit-comment', or both they will have access
Entrust::routeNeedsPermission('admin/post*', array('create-post', 'edit-comment'), null, false);

// if a user is a member of 'owner', 'writer', or both they will have access
Entrust::routeNeedsRole('admin/advanced*', array('owner','writer'), null, false);

// if a user is a member of 'owner', 'writer', or both, or user has 'create-post', 'edit-comment' they will have access
// if the 4th parameter is true then the user must be a member of Role and must have Permission
Entrust::routeNeedsRoleOrPermission(
    'admin/advanced*',
    array('owner', 'writer'),
    array('create-post', 'edit-comment'),
    null,
    false
);

Route filter

Entrust roles/permissions can be used in filters by simply using the can and hasRole methods from within the Facade:

Route::filter('manage_posts', function()
{
    // check the current user
    if (!Entrust::can('create-post')) {
        return Redirect::to('admin');
    }
});

// only users with roles that have the 'manage_posts' permission will be able to access any admin/post route
Route::when('admin/post*', 'manage_posts');

Using a filter to check for a role:

Route::filter('owner_role', function()
{
    // check the current user
    if (!Entrust::hasRole('Owner')) {
        App::abort(403);
    }
});

// only owners will have access to routes within admin/advanced
Route::when('admin/advanced*', 'owner_role');

As you can see Entrust::hasRole() and Entrust::can() checks if the user is logged in, and then if he or she has the role or permission. If the user is not logged the return will also be false.

Troubleshooting

If you encounter an error when doing the migration that looks like:

SQLSTATE[HY000]: General error: 1005 Can't create table 'laravelbootstrapstarter.#sql-42c_f8' (errno: 150)
    (SQL: alter table `role_user` add constraint role_user_user_id_foreign foreign key (`user_id`)
    references `users` (`id`)) (Bindings: array ())

Then it's likely that the id column in your user table does not match the user_id column in role_user. Make sure both are INT(10).

When trying to use the EntrustUserTrait methods, you encounter the error which looks like

Class name must be a valid object or a string

then probably you don't have published Entrust assets or something went wrong when you did it. First of all check that you have the entrust.php file in your config directory. If you don't, then try php artisan vendor:publish and, if it does not appear, manually copy the /vendor/zizaco/entrust/src/config/config.php file in your config directory and rename it entrust.php.

If your app uses a custom namespace then you'll need to tell entrust where your permission and role models are, you can do this by editing the config file in config/entrust.php

'role' => 'Custom\Namespace\Role'
'permission' => 'Custom\Namespace\permission'

License

Entrust is free software distributed under the terms of the MIT license.

Contribution guidelines

Support follows PSR-1 and PSR-4 PHP coding standards, and semantic versioning.

Please report any issue you find in the issues page.
Pull requests are welcome.

Comments
  • This cache store does not support tagging.

    This cache store does not support tagging.

    Happend after update to 5.2.

    Not sure if this has something to do with entrust but in the list I see that this issue has something to do with Repository->tags('role_user') and Cache::tags('role_user') in EntrustUserTrait.php line 29

    BadMethodCallException in C:\wamp\www\baseapp\vendor\laravel\framework\src\Illuminate\Cache\Repository.php line 380:
    This cache store does not support tagging.
    in Repository.php line 380
    at Repository->tags('role_user')
    at call_user_func_array(array(object(Repository), 'tags'), array('role_user')) in CacheManager.php line 296
    at CacheManager->__call('tags', array('role_user')) in Facade.php line 216
    at CacheManager->tags('role_user') in Facade.php line 216
    at Facade::__callStatic('tags', array('role_user')) in EntrustUserTrait.php line 29
    at Cache::tags('role_user') in EntrustUserTrait.php line 29
    at User->save() in EloquentUserProvider.php line 78
    

    Anyone else had this one? And ideas?

    opened by kickthemooon 75
  • Can't Install on laravel 5

    Can't Install on laravel 5

    in console he said Problem 1 - Installation request for zizaco/entrust dev-master -> satisfiable by zizaco/entrust[dev-master]. - Conclusion: remove laravel/framework 5.0.x-dev - zizaco/entrust dev-master requires laravelbook/ardent ~2.4 -> satisfiable by laravelbook/ardent[v2.4.0, v2.4.1, v2.4.2]. - laravelbook/ardent v2.4.0 requires illuminate/validation ~4.1 -> satisfiable by laravel/framework[4.1.x-dev, 4.2.x-dev], illuminate/validation[4.1.x-dev,

    opened by dearteno 36
  • Entrust issue Laravel 5.2

    Entrust issue Laravel 5.2

    Hello,

    I recently upgraded my installation to Laravel 5.2, unfortunately entrust is not compatible with this version.

    When I update the EntrustServiceProvider.php @ line 72 till 77 to:

            $this->app->singleton('command.entrust.migration', function ($app) {
                return new MigrationCommand();
            });
            $this->app->singleton('command.entrust.classes', function ($app) {
                return new ClassCreatorCommand();
            });
    

    It is all fine. Could you release the package with this fix?

    opened by Cannonb4ll 34
  • Blade directives not working!

    Blade directives not working!

    All the 3 blade directives are not working on my blade views in the laravel app. Rather they show up as plain text. Example below:

    @role('admin')

    Something here

    @endrole

    outputs this on my view in the browser: @role('admin') Something here @endrole

    opened by introwit 30
  • Class '\Role' not found in laravel 5

    Class '\Role' not found in laravel 5

    i have a problem as following:

    • composer.json "zizaco/entrust": "dev-laravel-5",
    • i was run migration & can create roles, permission
    • in model User, i made as guide from author:

    use Zizaco\Entrust\Traits\EntrustUserTrait;

    class User extends Eloquent { use EntrustUserTrait; // add this trait to your user model

    ...
    

    }

    then i attach role for an user: $user->attachRole($admin); // parameter can be an Role object, array, or id or $user->hasRole('admin');

    => i got an exception:

    PHP Fatal error: Class '\Role' not found in /Volumes/Data/IdooSources/ISAdminTools/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php on line 971 PHP Stack trace: PHP 1. {main}() /Volumes/Data/IdooSources/ISAdminTools/artisan:0 PHP 2. Illuminate\Foundation\Console\Kernel->handle() /Volumes/Data/IdooSources/ISAdminTools/artisan:36 PHP 3. Symfony\Component\Console\Application->run() /Volumes/Data/IdooSources/ISAdminTools/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:91 PHP 4. Symfony\Component\Console\Application->doRun() /Volumes/Data/IdooSources/ISAdminTools/vendor/symfony/console/Symfony/Component/Console/Application.php:126 PHP 5. Symfony\Component\Console\Application->doRunCommand() /Volumes/Data/IdooSources/ISAdminTools/vendor/symfony/console/Symfony/Component/Console/Application.php:195

    anyone can help me.

    thank in advance!

    opened by tidusvn05 20
  • composer update with Laravel 4.0.* gives error

    composer update with Laravel 4.0.* gives error

    Hi,

    I am having difficulty in updating my composer file. I get this error:

    Problem 1 - zizaco/entrust dev-master requires laravelbook/ardent 2.4.x -> satisfiable by laravelbook/ardent[v2.4.0]. - zizaco/entrust dev-master requires laravelbook/ardent 2.4.x -> satisfiable by laravelbook/ardent[v2.4.0]. - Conclusion: don't install laravelbook/ardent v2.4.0 - Installation request for zizaco/entrust dev-master -> satisfiable by zizaco/entrust[dev-master].

    Now I currently only use Laravel 4.0 version and my composer.json file looks like so:

    "require-dev": { "way/guard-laravel": "dev-master" }, "require": { "laravel/framework": "4.0.", "dflydev/markdown": "v1.0.2", "imagine/Imagine": "v0.4.1", "way/generators": "dev-master", "edvinaskrucas/notification": "1.", "zizaco/entrust": "dev-master", "zizaco/confide": "2.0.x" },

    Please can someone give me an ideas to why this is happening and any steps to fixing it at all?

    Thanks in advance Mark

    opened by mdunbavan 17
  • Call to undefined method Illuminate\Database\Query\Builder::cachedPermissions()

    Call to undefined method Illuminate\Database\Query\Builder::cachedPermissions()

    When I use ability method, i'm getting following error (laravel 5.2)

    ErrorException in Builder.php line 2161: Call to undefined method Illuminate\Database\Query\Builder::cachedPermissions()

    opened by shanka12 16
  • [BadMethodCallException] Call to undefined method Illuminate\Database\Query\Builder::attachPermission()

    [BadMethodCallException] Call to undefined method Illuminate\Database\Query\Builder::attachPermission()

    [BadMethodCallException] Call to undefined method Illuminate\Database\Query\Builder::attachPermission()

    I tried to attach permission if not present and got error -

    <?php
    
    use Illuminate\Database\Seeder;
    use App\Role;
    use App\Permission;
    use App\User;
    
    class AttachRolesAndPermissionsToUsers extends Seeder
    {
        /**
         * Run the database seeds.
         *
         * @return void
         */
        public function run()
        {
            $admin = Role::where('name', 'admin')->first();
            $moderator = Role::where('name', 'moderator')->first();
    
            $createPost = Permission::where('name', 'create-post')->first();
            $editUser = Permission::where('name', 'edit-user')->first();
    
    
            // attach role
            $adminUser = User::where('email', '[email protected]')->first();
            if(!$adminUser->hasRole('admin')) {
                $adminUser->attachRole($admin);
            }
    
            $moderatorUser = User::where('email', '[email protected]')->first();
            if(!$moderatorUser->hasRole('moderator')) {
                $moderatorUser->attachRole($moderator);
            }
    
            // attach Permission
            if(!$adminUser->can(['create-post', 'edit-user'])) {
                $adminUser->attachPermissions([$createPost, $editUser]);
            }
    
            if(!$moderatorUser->can('create-post')) {
                $moderatorUser->attachPermission($createPost);
            }
        }
    }
    

    I take a look on EntrustUserTrait and method is not there. It's in EntrustRoleTrait. Do i need to use that as well with EntrustUserTrait? is that case there will be collision.

    opened by im4aLL 16
  • Class name must be a valid object or a string

    Class name must be a valid object or a string

    php artisan entrust:migration

    [Symfony\Component\Debug\Exception\FatalErrorException] Class name must be a valid object or a string

    in config/auth.php

    add:

    'model' => 'App\Models\User', 'table' => 'users',

    Then created User Model:

    <?php
    namespace App\Models;
    
    use Illuminate\Database\Eloquent\Model;
    use Zizaco\Entrust\Traits\EntrustUserTrait;
    
    class User extends Model
    {
        use EntrustUserTrait; // add this trait to your user model
    
    }
    

    That's OK!

    opened by tanteng 16
  • Class 'EntrustSetupTables' not found

    Class 'EntrustSetupTables' not found

    I'm getting

    PHP Fatal error:  Class 'EntrustSetupTables' not found in /var/www/rudolf-ordini/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php on line 297
    {"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'EntrustSetupTables' not found","file":"\/var\/www\/rudolf-ordini\/vendor\/laravel\/framework\/src\/Illuminate\/Database\/Migrations\/Migrator.php","line":297}}
    

    Base confide and entrust setup. Following readmes

    This is my composer.json require section

    "require": {
        "laravel/framework": "4.2.*",
        "zizaco/confide": "3.2.x",
        "laravelbook/ardent": "dev-master",
        "zizaco/entrust": "dev-master"
    },
    

    Any clues?

    Bug Solved 
    opened by mauroartizzu 15
  • Too much queries!

    Too much queries!

    Yes, it is just to fucking much queries. I tried creating a mention system, I tried mentioning 10 users and I got 300+ queries. (It does duplicate queries)

    Bug 
    opened by jhemmmm 14
  • Message: Class 'Jenssegers\Blade\Blade' not found

    Message: Class 'Jenssegers\Blade\Blade' not found

    hi i using blade on my project but suddenly this things happens

    An uncaught Exception was encountered Type: Error

    Message: Class 'Jenssegers\Blade\Blade' not found

    Filename: C:\xampp\htdocs\inventory-fifo-master\application\helpers\view_helper.php

    Line Number: 16

    Backtrace:

    File: C:\xampp\htdocs\inventory-fifo-master\application\controllers\Login.php Line: 6 Function: view

    File: C:\xampp\htdocs\inventory-fifo-master\index.php Line: 315 Function: require_once

    do anyone knows what to do? thx before

    opened by rahmadanityas 0
  • Laravel 8 login error

    Laravel 8 login error

    TypeError Argument 1 passed to Illuminate\Auth\EloquentUserProvider::validateCredentials() must be an instance of Illuminate\Contracts\Auth\Authenticatable, instance of App\Models\User given, called in C:\xampp\htdocs\laravel_qrcode_test\vendor\laravel\framework\src\Illuminate\Auth\SessionGuard.php on line 422 http://localhost:8000/login

    opened by jollytoks 1
  • Discussion about the future of this package

    Discussion about the future of this package

    Hey guys. I've forked this package while ago to be able to upgrade one Laravel project I've been working on.

    To be honest I did not think people will be using my fork, I even added a note in the readme. But people use it, and even creating pull requests.

    Screen Shot 2021-09-22 at 22 20 08

    So, I'm opening this issue for discussion to hear from you if it makes sense to start enhancing/updating my fork, or is it a nonsense? Maybe you have a better idea?

    Thanks.

    P.S. here is the fork.

    opened by hakobyansen 5
  • A fork to support Laravel 7/8

    A fork to support Laravel 7/8

    Couldn't get Laravel 5.4 app upgraded to the latest Laravel 7 because of the dependencies of the zizaco/entrust package.

    Had to fork it and upgrade its dependencies.

    Here is the fork if you need - codebot/entrust

    opened by hakobyansen 0
Releases(1.8.0-alpha1)
Owner
Zizaco
Zizaco
Manage authorization with granular role-based permissions in your Laravel Apps.

Governor For Laravel Manage authorization with granular role-based permissions in your Laravel apps. Goal Provide a simple method of managing ACL in a

GeneaLabs, LLC 149 Dec 23, 2022
Tech-Admin is Laravel + Bootstrap Admin Panel With User Management And Access Control based on Roles and Permissions.

Tech-Admin | Laravel 8 + Bootstrap 4 Tech-Admin is Admin Panel With Preset of Roles, Permissions, ACL, User Management, Profile Management. Features M

TechTool India 39 Dec 23, 2022
User role and Permission Management system with Paticie package

User role and Permission Management system with Paticie package Installation instruction Download or git clone https://github.com/KKOO727/User-role-ma

Ninja 2 Mar 4, 2022
A user, group, role and permission management for Codeigniter 4

CI4-Auth CI4-Auth is a user, group, role and permission management library for Codeigniter 4. CI4-Auth is based on the great Myth-Auth library for Cod

George Lewe 15 Dec 16, 2022
GUI manager for RBAC (Role Base Access Control) Yii2. Easy to manage authorization of user

RBAC Manager for Yii 2 GUI manager for RBAC (Role Base Access Control) Yii2. Easy to manage authorization of user ?? . Documentation Important: If you

MDMunir Software 1.2k Jan 7, 2023
Laravel Auth is a Complete Build of Laravel 8 with Email Registration Verification, Social Authentication, User Roles and Permissions, User Profiles, and Admin restricted user management system.

Laravel Auth is a Complete Build of Laravel 8 with Email Registration Verification, Social Authentication, User Roles and Permissions, User Profiles, and Admin restricted user management system. Built on Bootstrap 4.

Jeremy Kenedy 2.8k Dec 31, 2022
Handle roles and permissions in your Laravel application

Laratrust (Laravel Package) Version Compatibility Laravel Laratrust 8.x 6.x 7.x 6.x 6.x 6.x 5.6.x - 5.8.x 5.2 5.3.x - 5.5.x 5.1 5.0.x - 5.2.x 4.0. Ins

Santiago García 2k Dec 30, 2022
Roles & Permissions for Laravel 8 / 7 / 6 / 5

Defender Defender is an Access Control List (ACL) Solution for Laravel 5 / 6 / 7 (single auth). (Not compatible with multi-auth) With security and usa

Artesãos 437 Dec 22, 2022
Laravel Users (Roles & Permissions, Devices, Password Hashing, Password History).

LARAVEL USERS Roles & Permissions Devices Password Hashing Password History Documentation You can find the detailed documentation here in Laravel User

Pharaonic 8 Dec 14, 2022
Powerful package for handling roles and permissions in Laravel 5

Roles And Permissions For Laravel 5 Powerful package for handling roles and permissions in Laravel 5 (5.1 and also 5.0). Installation Composer Service

Roman Bičan 1.2k Dec 17, 2022
Laravel Roles and Permissions

Introduction to Laravel Roles and Permission App Starter Kit Roles and sanctions are a paramount part of many web applications. In project, we have op

Brian Kiprono Koech 1 Nov 1, 2021
PermissionsMakr is a Laravel package that will help any developer to easily manage the system's users permissions

PermissionsMakr is a Laravel package that will help any developer to easily manage the system's users permissions

Alvarium Digital 3 Nov 30, 2021
A Powerful package for handling roles and permissions in Laravel with GUI.

Laravel Roles A Powerful package for handling roles and permissions in Laravel. Supports Laravel 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 6.0, 7.0, and 8.0+. Tab

Jeremy Kenedy 827 Jan 1, 2023
This package helps you to associate users with permissions and permission groups with laravel framework

Laravel ACL This package allows you to manage user permissions and groups in a database, and is compatible with Laravel v5.8 or higher. Please check t

Mateus Junges 537 Dec 28, 2022
This is a lightweight package that allows you assign roles and permissions to any Laravel model, or on a pivot table (many to many relationship).

Simple Laravel roles and permissions Introduction This package allows you to assign roles and permissions to any laravel model, or on a pivot table (m

null 52 Nov 10, 2022
Laravel mongodb permissions

Laravel mongodb permissions

null 4 May 10, 2022
Laravel fortify ve spatie permissions eklentileri üzerine geliştirilmiş kullanıma hazır panel

Herkobi Panel Laravel ile yeni bir projeye başlayacak kişiler için Laravel Fortify üzerine geliştirdiğimiz arayüze (https://github.com/bulentsakarya/l

Herkobi 10 Jun 15, 2023
Associate users with roles and permissions

Associate users with permissions and roles Sponsor If you want to quickly add authentication and authorization to Laravel projects, feel free to check

Spatie 10.9k Jan 3, 2023
Minimalistic token-based authorization for Laravel API endpoints.

Bearer Minimalistic token-based authorization for Laravel API endpoints. Installation You can install the package via Composer: composer require ryang

Ryan Chandler 74 Jun 17, 2022