Associate users with roles and permissions

Overview

Social Card of Laravel Permission

Associate users with permissions and roles

Sponsor

If you want to quickly add authentication and authorization to Laravel projects, feel free to check Auth0's Laravel SDK and free plan at https://auth0.com/developers.

Latest Version on Packagist Total Downloads

Documentation, Installation, and Usage Instructions

See the DOCUMENTATION for detailed installation and usage instructions.

What It Does

This package allows you to manage user permissions and roles in a database.

Once installed you can do stuff like this:

// Adding permissions to a user
$user->givePermissionTo('edit articles');

// Adding permissions via a role
$user->assignRole('writer');

$role->givePermissionTo('edit articles');

Because all permissions will be registered on Laravel's gate, you can check if a user has a permission with Laravel's default can function:

$user->can('edit articles');

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

Postcardware

You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium.

We publish all received postcards on our company website.

Credits

This package is heavily based on Jeffrey Way's awesome Laracasts lessons on permissions and roles. His original code can be found in this repo on GitHub.

Special thanks to Alex Vanderbist who greatly helped with v2, and to Chris Brown for his longtime support helping us maintain the package.

And a special thanks to Caneco for the logo

Alternatives

License

The MIT License (MIT). Please see License File for more information.

Comments
  • Add model/permissions caching

    Add model/permissions caching

    This adds substantial speed increases by caching the associations between models and permissions. Part of the changes focus on the PermissionRegistar, specifically caching for getPermissions(), thanks to @klincheg for these changes.

    The rest is focussed on caching calls to HasPermissionTo() in HasPermissions.php.

    The association is cached under a compound key comprised of the package key, the model and the permission: spatie.permission.cache.App.Models.User.12.Spatie.Permission.Models.Permissions.view-dashboard

    These values are also used as tags: spatie.permission.cache, App.Models.User.12, Spatie.Permission.Models.Permissions.view-dashboard (if tags are not supported then the package continues as before, as they are essential to this functionality)

    As we are still using the package cache key, then the already existing cache-busting should not need to be updated to account for these changes. However, the usage of the model and the permissions in the tags allow for future addition of model specific, or permission specific cache-busting, helping prevent the stampeding herd effect that larger applications may experience each time a permission or role is updated.

    Performance tests involved seeding a database with 250 users, who were assigned between 2 - 4 roles, which were assigned between 30 - 500 permissions. Then each permission for each user was tested:

    $this->users->each(function (User $user) {
        $user->getAllPermissions()->each(function (Permission $permission) use ($user) {
            $this->assertTrue($user->can($permission->name));
        });
    });
    

    I went through different variations of the above, some including non-assigned permissions, etc.

    These changes increase the speed of the checks from several minutes down to 4 - 20 seconds (approx 32000 assertions in a couple of seconds in some tests). And the database calls went from 1800+ to 0.

    Things to note/get feedback on are:

    • Is the current cache busting effective enough for these changes? I reviewed the tests and ran through some real-world examples and had no issues, but a second opinion would be great.
    • The changes to the config could be breaking
    • The naming of checkHasPermissionTo() inside HasPermissions could be confused with the newly added method checkPermissionTo()
    • Clutter. I'm concious this has added a fair bit of new methods and checks, and I don't want to clutter up the package.

    Closes #732 Fixes #759 Fixes #789

    opened by fullstackfool 41
  • Next major release -- Features/Requests for v3

    Next major release -- Features/Requests for v3

    It feels like the last couple of months a lot of issues were related to the multi-guard functionality introduced in v2. Apart from that there have been some vague caching issues as well. Time to do something about that in v3 of the package.

    The multi-guard issue

    Supporting multiple guards has added a lot of complexity to the package and made it feel quite "heavy". The multi-guard functionality is definitely a selling point for this package but it also seems to confuse some users that are new to the framework and haven't learned about guards yet. Not to mention the countless times a misconfiguration in auth.php causes the wrong guard to be used.

    Some possible solutions:

    • completely dropping support for guards - as @drbyte and I discussed at Laracon removing all support for multiple guards would make the package a lot easier to maintain, simpler and lighter.
    • my personal favourite: drop guard support but keep Permissions and Roles polymorphic relations. This means any model can have roles and permissions but there's no extra functionality related to guards.
    • maintaining two branches: one with- and one without support for guards.

    Caching issue

    There's no interface or CLI tool that comes with the package to create and manage roles/permissions. This means a lot of users revert to editing the DB to manage permissions causing the cache to be rendered invalid. Even though it's well documented this seems to be an issue that keeps coming back. Maybe caching should be limited to a single request lifecycle by default and configurable for anyone that needs more anything else?


    Any thoughts on these two issues or suggestions for other features for v3 of the package are very welcome!

    revisit for future version 
    opened by AlexVanderbist 41
  • $guarded value on Role/Permission class causes failure in latest laravel 7.x and 6.x

    $guarded value on Role/Permission class causes failure in latest laravel 7.x and 6.x

    With regards the latest laravel update that is documented here: Security Release: Laravel 6.18.35, 7.24.0

    And also the code change happened here in the 6.x branch https://github.com/laravel/framework/pull/33777

    These two updates have broken the functionality when you try to perform a with() query on the Roles model.

    For example I have the code:

    Role::orderBy('type')
        ->withCount('users')
        ->paginate();
    

    This gives the error:

    PHP Notice:  Undefined index: guard_name in app/vendor/spatie/laravel-permission/src/Models/Role.php on line 62
    TypeError: Argument 1 passed to getModelForGuard() must be of the type string, null given, called in app/vendor/spatie/laravel-permission/src/Models/Role.php on line 62
    

    It seems the solution is to just set the $guarded property to [] in the model classes.

    If someone is extending the class this is easy to fix, but unfortunately it isn't very clear immediately what error caused this.

    If it is alright with the maintainers I don't mind making the change to the model files to the code that will make it functional.

    System Info:

    Laravel: 6.18.35 PHP: 7.3.8 Permissions: 3.13

    opened by ReeceM 36
  • [Bug? 4.3.0] Checking Permission via can() return PermissionDoesNotExists

    [Bug? 4.3.0] Checking Permission via can() return PermissionDoesNotExists

    Hi. First, thanks for this great packages. I've been using this packages since version 1.

    I have user with Role 'System Administrator', and this roles has permission named 'dashboard', 'logs', etc. When I'm checking the user's permission via can, it throws Spatie\Permission\Exceptions\PermissionDoesNotExist.

    • spatie/laravel-permission package version: 4.3.0
    • illuminate/framework package: v8.55.0

    PHP version: 8.0.7 Database version: MySQL 8.0.25

    This is not happening prior to version 4.3.0. We have traced this issue, and found that getPermissions on Spatie\Permission\PermissionRegistrar is the culprit here.

    This is how we resolve this problem:

            $permissions = $this->permissions->$method(static function ($permission) use ($params) {
                foreach ($params as $attr => $value) {
                    if ($permission->getAttribute($attr) == $value) {
                        return true;
                    }
                }
    
                return false;
            });
    

    I think the return value are swapped? If I swap the 'true' and 'false' value like above, it behaves normally, and I only get PermissionDoesNotExists exception only when I'm supplying it with wrong / invalid permission.

    Thanks

    opened by shadowbane 35
  • PermissionDoesNotExist while Permission actually does exist.

    PermissionDoesNotExist while Permission actually does exist.

    Hello,

    I am trying to implement permissions in my pages to hide menu items, by example. Currently, I am using this:

    @if(auth()->user()->hasPermissionTo('view_admin_top_menu'))
    //content
    @endif
    

    But it keeps returning the PermissionDoesNotExist exception while I am very sure the permission is in the database. Also, @hasrole() works... so it is very weird to me.

    Thanks.

    opened by bjarn 34
  • guard_name also as a function

    guard_name also as a function

    Could it be possible to make $guard_name a property and a static function in the same way Nova does it with 'group' and 'name'? So we can use config('nova.guard')? I'm using a 'web' guard for normal users and a 'back' guard for admin users.

    enhancement help wanted revisit for future version 
    opened by gerardnll 32
  • There is no permission named `edit articles` for guard `web`.

    There is no permission named `edit articles` for guard `web`.

    I am having issue when seeding the roles and permissions. I even copy their sample on database seeding here https://github.com/spatie/laravel-permission#database-seeding. I even clear and removed cache before seeding and still I get that error as you can see on this screenshot https://www.screencast.com/t/PAMOsZjS

    Anyone could help?

    Thank you.

    opened by jacktyler2318 29
  • ErrorException  : Trying to access array offset on value of type null. On fresh laravel installation.

    ErrorException : Trying to access array offset on value of type null. On fresh laravel installation.

    I can't install the package on my recent laravel project. It works fine on the previous ones. Here is the error I get

    `composer require spatie/laravel-permission Using version ^3.6 for spatie/laravel-permission ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 1 install, 0 updates, 1 removal

    • Removing spatie/laravel-view-components (1.2.0)
    • Installing spatie/laravel-permission (3.6.0): Loading from cache Writing lock file Generating optimized autoload files

    Illuminate\Foundation\ComposerScripts::postAutoloadDump @php artisan package:discover --ansi

    ErrorException : Trying to access array offset on value of type null

    at /home/abdellah/Documents/PROJECTS/Bank/vendor/spatie/laravel-permission/src/PermissionServiceProvider.php:61 57| protected function registerModelBindings() 58| { 59| $config = $this->app->config['permission.models']; 60|

    61| $this->app->bind(PermissionContract::class, $config['permission']); 62| $this->app->bind(RoleContract::class, $config['role']); 63| } 64| 65| protected function registerBladeExtensions()

    Exception trace:

    1 Illuminate\Foundation\Bootstrap\HandleExceptions::handleError() /home/abdellah/Documents/PROJECTS/Bank/vendor/spatie/laravel-permission/src/PermissionServiceProvider.php:61

    2 Spatie\Permission\PermissionServiceProvider::registerModelBindings() /home/abdellah/Documents/PROJECTS/Bank/vendor/spatie/laravel-permission/src/PermissionServiceProvider.php:36

    Please use the argument -v to see more details. Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

    Installation failed, reverting ./composer.json to its original content.`

    support 
    opened by abdellahrk 28
  • Question: Multi Tenant

    Question: Multi Tenant

    In a SaaS kind of app, I want the Roles to be tenant specific, meaning:

    Roles for App X | Roles for App Y ------------ | ------------- Owner | Superintendent Worker| All mighty Maintenance| Superman

    Its not only a matter of naming, each role has different permissions, and App X can't see App Y roles and vice versa. Also there can be an infinite number of apps...

    Any suggestion for achieving this? Maybe using guards? Maybe adding a tenant column to the tables? Thanks.

    revisit for future version 
    opened by jonagoldman 27
  • [Proposal] Role Hierarchy Level (integer)

    [Proposal] Role Hierarchy Level (integer)

    Hey all,

    thanks for this awesome package - i really like it as it is quite easy to use. Recently, i stumbled upon a problem, which i thought i could share with you - this might be a contribution for your package.

    Problem

    In my application i have Teams (a User can be in multiple Teams) and Projects (a Project can have multiple Teams). Furthermore, a Team can have a specific Role within a Project. Therefore, one User can have multiple Roles within a Project.

    For now, let us call these Roles Owner, Manager and Member (as they already imply some kind of Hierarchy: Owner > Manager > Member.

    I would like to retrieve the highest (i.e., the role with the most access rights) Role for one specific User within a Project.

    Idea

    I thought it may be possible to enhance the Role table and add an additional level (int, default 0) field to the database. This field would act as some kind of hierarchy.

    In the given example, one could just define Owner (10) > Manager (5) > Member (1). Note that the numbers indicate the level.

    When retrieving all Roles for the User within a Project we would just need to sort by level and we're already set up!

    Furthermore, this idea could be enhanced in order to provide some additional functions to restrict access not only by Role or Permission but also by Level. Think about a method like this hasAtLeastRoleLevel(int level) to check, if the level of the User is higher than - therefore he has access..

    What do you think about this feature? Best

    enhancement revisit for future version 
    opened by johannesschobel 25
  • Question: User with diferent Roles and Companies

    Question: User with diferent Roles and Companies

    Hi! I need to implement in a system where a user can be from different companies with different rules for each of them. Ex: User X - Company A - Admin User X - Company B - Manager Remembering that my system is not Multi Tenancy. It's possible with this package?

    support 
    opened by georgecpacheco 24
  • Fix returning all roles instead of the assigned

    Fix returning all roles instead of the assigned

    This behavior occurs when a controller requires a model with a relationship before loading the roles and the relationship uses the hasRole function

    web.php

    Route::get('/test', function(){
        $var = MyParent::withCount('limitedView')->get(); //not used but creates the issue
        return[ Auth::user()->roles, App\Models\User::find(Auth::id())->roles ];
    });
    

    MyParent.php

    class MyParent extends Model
    {
        public function children(): HasMany {
            return $this->hasMany(Child::class);
        }
    
        public function limitedView() {
            $query = $this->children();
    
            if(!Auth::user()->hasRole('Super-Admin')){
                $query->orWhere('age', '>=', 18);
            }
    
            return $query;
        }
    }
    ```
    
    opened by erikn69 0
  • Why does `getAllPermissions()` with where condition (useing `like`) isn't working in Laravel?

    Why does `getAllPermissions()` with where condition (useing `like`) isn't working in Laravel?

    Discussed in https://github.com/spatie/laravel-permission/discussions/2191

    Originally posted by dev-ramchander September 30, 2022 I am working in larael9 with spatie package to manage roles and permissions. I want to fetch user permissions with where condtion.

    my permissions table is as following

    id | name                           | guard_name    | created_at          | updated_at
    -------------------------------------------------------------------------------------------------
    14 | admin_side_barmenu_dashboard   | web           | 2022-09-29 13:52:00 | 2022-09-29 13:52:00
        
    15 | admin_side_barmenu_users       | web           | 2022-09-29 13:52:00 | 2022-09-29 13:52:00
        
    16 | admin_side_barmenu_settings    | web           | 2022-09-29 13:52:00 | 2022-09-29 13:52:00
        
    17 | admin_side_barmenu_roles       | web           | 2022-09-29 13:52:00 | 2022-09-29 13:52:00
        
    18 | admin_side_barmenu_permission  | web           | 2022-09-29 13:52:00 | 2022-09-29 13:52:00
    

    what i am trying to achieve is, get permissions were name start with 'admin_side_barmenu' for auth user I am able to get all the permissions but not able to get where it start with 'admin_side_barmenu'.

    I have tried the following way. auth()->user()->getAllPermissions()->where('name', 'like', '%admin_side_barmenu%')->toArray();

    Following is working for me if it fetchs with full name

    auth()->user()->getAllPermissions()->where('name', 'like', 'admin_side_barmenu_dashboard')->toArray();

    Thanks!

    opened by ram-richestsoft 1
  • auth:user()->roles returning every role instead of just the assigned ones

    auth:user()->roles returning every role instead of just the assigned ones

    Hi,

    Thank you for this great package and all other open-source packages you provide. I would love to do a PR about this myself but I just couldn't figure out the fix.

    I really appreciate the time you take to reply every issue.

    I have found that under certain conditions where a relationship is retrieved in a controller before loading the roles 'auth:user()->roles' returns every role not just the assigned ones.

    Some people have found the same problem but could not be reproduced so far. Related issues: #2161, #1829

    Versions

    • spatie/laravel-permission package version: 5.5.5
    • laravel/framework package: 9.32.0

    PHP version: 8.1.1

    Database version: sqlite

    To Reproduce This behavior occurs when a controller requires a model with a relationship before loading the roles and the relationship uses the hasRole function

    web.php

    Route::get('/test', function(){
        
        $var = MyParent::withCount('limitedView')->get(); //not used but creates the issue
        
        return[ Auth::user()->roles, App\Models\User::find(Auth::id())->roles ];
    });
    

    MyParent.php

    class MyParent extends Model
    {
        use HasFactory;
    
        public function children(): HasMany
        {
            return $this->hasMany(Child::class);
        }
    
        public function limitedView(){
            $query = $this->children();
    
            if(!Auth::user()->hasRole('Super-Admin')){
                $query->orWhere('age', '>=', 18);
            }
    
            return $query;
        }
    }
    

    Basic Test

    public function test_example()
        {
            app(DatabaseSeeder::class)->call(PermissionsDemoSeeder::class);
    
            $user = User::find(1); //Role: writer
            
            $this->be($user);
    
            list($rolesBefore, $rolesAfter) = $this->get('/test')->json();
    
            $this->assertCount(1,$rolesBefore);
            $this->assertCount(1,$rolesAfter);
            $this->assertEquals($rolesBefore[0]["name"], "writer");
            $this->assertEquals($rolesAfter[0]["name"], "writer");
    
        }
    

    Example Application A minimal repo with a test implemented can be found at: https://github.com/SIDESO/issue_demo_spatie_permissions

    Expected behavior Only the assigned roles should be returned.

    Additional context The problem disappears adding to the user model:

    protected $with=['roles'];
    

    Environment (please complete the following information, because it helps us investigate better):

    • OS: Windows10
    • Version: 21H2
    opened by IGedeon 3
  • Problem with sync role to user when param teams is true

    Problem with sync role to user when param teams is true

    Hello, have a little problem when try sync role and the value of the param teams in config is true.

    The way i use to for sync role with is the next:

    ` $user = User::create([ 'first_name' => 'Administrador', 'last_name' => 'Sistema', 'number_document' => '1088348388', 'id_type_document' => '1', 'email' => '[email protected]', 'password' => '123', ]);

        $user->companies()->sync('1');
    
        $role = Role::create(['name' => 'Super Admin', 'guard_name' => 'api', "company_id" => '1']);
        $user->assignRole([$role]);
    

    `

    i can see the next with view the code the method for assignRole in the trait HasRoles

    $array[$role->getKey()] = PermissionRegistrar::$teams && !is_a($this, Permission::class) ? [PermissionRegistrar::$teamsKey => getPermissionsTeamId()] : [];

    when call the method getPermissionsTeamId return null, then at moment to the execute query generate error because the field indicate in the param team_foreign_key value is null.

    Note: sorry for my english, but i don't speak english, i speak spanish.

    Thanks.

    opened by lunuzzerin 1
  • Delegate permission filter to another method

    Delegate permission filter to another method

    This could help with third party customization of the package

    It is the same code, only i did move it to his own method, it is NOT A BREAKING CHANGE, it could be helpful This change is TESTED

    Little and marginal optimitations(less duplicity) https://github.com/spatie/laravel-permission/blob/67e54e2c7941d7aaa93c207549cdb7c5a44c68f5/src/Traits/HasPermissions.php#L132-L150 https://github.com/spatie/laravel-permission/blob/67e54e2c7941d7aaa93c207549cdb7c5a44c68f5/src/Traits/HasPermissions.php#L274-L286

    opened by angeljqv 0
  • Delegate permission collection filter to another method

    Delegate permission collection filter to another method

    This could help with customization of the package

    It is the same code, only i did move it to his own method, it is NOT A BREAKING CHANGE, it could be helpful This change is TESTED

    opened by angeljqv 0
Releases(5.5.5)
  • 5.5.5(Jun 29, 2022)

    What's Changed

    • Custom primary keys tests(Only tests) by @erikn69 in https://github.com/spatie/laravel-permission/pull/2096
    • [PHP 8.2] Fix ${var} string interpolation deprecation by @Ayesh in https://github.com/spatie/laravel-permission/pull/2117
    • Use getKey, getKeyName instead of id by @erikn69 in https://github.com/spatie/laravel-permission/pull/2116
    • On WildcardPermission class use static instead of self for extending by @erikn69 in https://github.com/spatie/laravel-permission/pull/2111
    • Clear roles array after hydrate from cache by @angeljqv in https://github.com/spatie/laravel-permission/pull/2099

    New Contributors

    • @Ayesh made their first contribution in https://github.com/spatie/laravel-permission/pull/2117

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.5.4...5.5.5

    Source code(tar.gz)
    Source code(zip)
  • 5.5.4(May 16, 2022)

    What's Changed

    • Support custom primary key names on models by @erikn69 in https://github.com/spatie/laravel-permission/pull/2092
    • Fix UuidTrait on uuid doc page by @abhishekpaul in https://github.com/spatie/laravel-permission/pull/2094
    • Support custom fields on cache by @erikn69 in https://github.com/spatie/laravel-permission/pull/2091

    New Contributors

    • @abhishekpaul made their first contribution in https://github.com/spatie/laravel-permission/pull/2094

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.5.3...5.5.4

    Source code(tar.gz)
    Source code(zip)
  • 5.5.3(May 5, 2022)

    What's Changed

    • Update .gitattributes by @angeljqv in https://github.com/spatie/laravel-permission/pull/2065
    • Remove double semicolon from add_teams_fields.php.stub by @morganarnel in https://github.com/spatie/laravel-permission/pull/2067
    • [V5] Allow revokePermissionTo to accept Permission[] by @erikn69 in https://github.com/spatie/laravel-permission/pull/2014
    • [V5] Improve typing in role's findById and findOrCreate method by @itsfaqih in https://github.com/spatie/laravel-permission/pull/2022
    • [V5] Cache loader improvements by @erikn69 in https://github.com/spatie/laravel-permission/pull/1912

    New Contributors

    • @morganarnel made their first contribution in https://github.com/spatie/laravel-permission/pull/2067
    • @itsfaqih made their first contribution in https://github.com/spatie/laravel-permission/pull/2022

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.5.2...5.5.3

    Source code(tar.gz)
    Source code(zip)
  • 5.5.2(Mar 9, 2022)

    What's Changed

    • [Fixes BIG bug] register blade directives after resolving blade compiler by @tabacitu in https://github.com/spatie/laravel-permission/pull/2048

    New Contributors

    • @tabacitu made their first contribution in https://github.com/spatie/laravel-permission/pull/2048

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.5.1...5.5.2

    Source code(tar.gz)
    Source code(zip)
  • 5.5.1(Mar 3, 2022)

    What's Changed

    • Spelling correction by @gergo85 in https://github.com/spatie/laravel-permission/pull/2024
    • update broken link to laravel exception by @kingzamzon in https://github.com/spatie/laravel-permission/pull/2023
    • Fix Blade Directives incompatibility with renderers by @erikn69 in https://github.com/spatie/laravel-permission/pull/2039

    New Contributors

    • @gergo85 made their first contribution in https://github.com/spatie/laravel-permission/pull/2024
    • @kingzamzon made their first contribution in https://github.com/spatie/laravel-permission/pull/2023

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.5.0...5.5.1

    Source code(tar.gz)
    Source code(zip)
  • 5.5.0(Jan 11, 2022)

  • 5.4.2(Jan 3, 2022)

    What's Changed

    • Fix links to docs by @erikn69 in https://github.com/spatie/laravel-permission/pull/1973
    • [V5] Fix Duplicate entry 'roles_name_guard_name_unique' on migration for teams by @erikn69 in https://github.com/spatie/laravel-permission/pull/1970
    • [v5] [docs] fix use multiple guards link in basic usage page by @Kamona-WD in https://github.com/spatie/laravel-permission/pull/1965
    • [V5] Teams fixes(Only tests) by @erikn69 in https://github.com/spatie/laravel-permission/pull/1911
    • Use global helpers, Small fix by @angeljqv in https://github.com/spatie/laravel-permission/pull/1963
    • Replace is_array with Arr::wrap by @angeljqv in https://github.com/spatie/laravel-permission/pull/1962
    • Add Cache Repository getter on PermissionRegistrar by @angeljqv in https://github.com/spatie/laravel-permission/pull/1946

    New Contributors

    • @Kamona-WD made their first contribution in https://github.com/spatie/laravel-permission/pull/1965
    • @angeljqv made their first contribution in https://github.com/spatie/laravel-permission/pull/1963

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.4.1...5.4.2

    Source code(tar.gz)
    Source code(zip)
  • 5.4.1(Dec 17, 2021)

    What's Changed

    • Adds documentation for LazilyRefreshDatabase by @lukeraymonddowning in https://github.com/spatie/laravel-permission/pull/1952
    • Fix .gitattributes by @PaolaRuby in https://github.com/spatie/laravel-permission/pull/1945
    • Livewire Role and Permissions. by @alighasemzadeh in https://github.com/spatie/laravel-permission/pull/1928
    • Fix teams upgrade migration by @erikn69 in https://github.com/spatie/laravel-permission/pull/1959
    • [V5] WherePivot instead of only Where on team relation pivot, better readability by @erikn69 in https://github.com/spatie/laravel-permission/pull/1944

    New Contributors

    • @lukeraymonddowning made their first contribution in https://github.com/spatie/laravel-permission/pull/1952
    • @PaolaRuby made their first contribution in https://github.com/spatie/laravel-permission/pull/1945
    • @alighasemzadeh made their first contribution in https://github.com/spatie/laravel-permission/pull/1928

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.4.0...5.4.1

    Source code(tar.gz)
    Source code(zip)
  • 5.4.0(Nov 17, 2021)

    What's Changed

    • Add support for PHP 8.1 by @freekmurze in https://github.com/spatie/laravel-permission/pull/1926

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.3.2...5.4.0

    Source code(tar.gz)
    Source code(zip)
  • 5.3.2(Nov 17, 2021)

    What's Changed

    • [V5] Support for custom key names on Role,Permission by @erikn69 in https://github.com/spatie/laravel-permission/pull/1913

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.3.1...5.3.2

    Source code(tar.gz)
    Source code(zip)
  • 5.3.1(Nov 4, 2021)

    What's Changed

    • [V5] Fix hints, support int on scopePermission() (#1863) by @erikn69 in https://github.com/spatie/laravel-permission/pull/1908

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.3.0...5.3.1

    Source code(tar.gz)
    Source code(zip)
  • 5.3.0(Oct 29, 2021)

    What's Changed

    • [Docs] Update blade-directives.md by @rizkhal in https://github.com/spatie/laravel-permission/pull/1903
    • Option for custom logic for checking permissions by @ulhaq in https://github.com/spatie/laravel-permission/pull/1891

    New Contributors

    • @rizkhal made their first contribution in https://github.com/spatie/laravel-permission/pull/1903
    • @ulhaq made their first contribution in https://github.com/spatie/laravel-permission/pull/1891

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.2.0...5.3.0

    Source code(tar.gz)
    Source code(zip)
  • 5.2.0(Oct 28, 2021)

    What's Changed

    • [V5] Fix detaching on all teams intstead of only current #1888 by @erikn69 in https://github.com/spatie/laravel-permission/pull/1890
    • [V5] Add uuid compatibility support on teams by @erikn69 in https://github.com/spatie/laravel-permission/pull/1857
    • Adds setRoleClass method to PermissionRegistrar by @timschwartz in https://github.com/spatie/laravel-permission/pull/1867
    • Load permissions for preventLazyLoading by @bahramsadin in https://github.com/spatie/laravel-permission/pull/1884
    • [V5] Doc for Super Admin on teams by @erikn69 in https://github.com/spatie/laravel-permission/pull/1845

    New Contributors

    • @timschwartz made their first contribution in https://github.com/spatie/laravel-permission/pull/1867
    • @bahramsadin made their first contribution in https://github.com/spatie/laravel-permission/pull/1884

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.1.1...5.2.0

    Source code(tar.gz)
    Source code(zip)
  • 4.4.3(Oct 28, 2021)

    What's Changed

    • [V4] Fix hints, support int on scopePermission() by @erikn69 in https://github.com/spatie/laravel-permission/pull/1863

    Full Changelog: https://github.com/spatie/laravel-permission/compare/4.4.1...4.4.3

    Source code(tar.gz)
    Source code(zip)
  • 4.4.2(Oct 28, 2021)

    What's Changed

    • [V4] Fix hints, support int on scopePermission() by @erikn69 in https://github.com/spatie/laravel-permission/pull/1863

    Full Changelog: https://github.com/spatie/laravel-permission/compare/4.4.1...4.4.2

    Source code(tar.gz)
    Source code(zip)
  • 5.1.1(Sep 1, 2021)

  • 4.4.1(Sep 1, 2021)

  • 5.1.0(Aug 31, 2021)

    • No longer flushes cache when changing role/permission assignments to users because user cache is in-memory. #1832 (It now only flushes when changing permissions-assigned-to-roles, or roles-assigned-to-permissions.) NOTE: You should test your app to be sure that you don't accidentally have deep dependencies on cache resets happening automatically in these cases. ALSO NOTE: If you have added custom code which depended on these flush operations, you may need to add your own cache-reset calls.
    Source code(tar.gz)
    Source code(zip)
  • 5.0.0(Aug 31, 2021)

    • Change default-guard-lookup to prefer current user's guard This has been requested for a long time, but has potential breaking-changes. See BC note in #1817

    • Added Teams/Groups feature (see docs, or PR #1804)

    • Customized pivots instead of role_id,permission_id #1823

    Source code(tar.gz)
    Source code(zip)
  • 4.4.0(Aug 28, 2021)

    • Avoid BC break (removed interface change) on cache change added in 4.3.0 #1826
    • Made cache even smaller #1826
    • Avoid re-sync on non-persisted objects when firing Eloquent::saved #1819
    Source code(tar.gz)
    Source code(zip)
  • 4.3.0(Aug 17, 2021)

  • 4.2.0(Jun 4, 2021)

  • 4.1.0(Jun 2, 2021)

  • 4.0.1(Mar 22, 2021)

    No core changes. Simply added comments to migration file to explain how to avoid "Specified key is too long ... must not be more than 1000 bytes" errors on MySQL.

    Source code(tar.gz)
    Source code(zip)
  • 4.0.0(Jan 27, 2021)

    4.0.0 - 2021-01-27

    • Drop support on Laravel 5.8 #1615
    • Fix bug when adding roles to a model that doesn't yet exist #1663
    • Enforce unique constraints on database level #1261
    • Changed PermissionRegistrar::initializeCache() public to allow reinitializing cache in custom situations. #1521
    • Use Eloquent\Collection instead of Support\Collection for consistency, collection merging, etc #1630

    This package now requires PHP 7.2.5 and Laravel 6.0 or higher. If you are on a PHP version below 7.2.5 or a Laravel version below 6.0 you can use an older version of this package.

    Source code(tar.gz)
    Source code(zip)
  • 3.18.0(Nov 27, 2020)

  • 3.17.0(Sep 16, 2020)

    • Optional $guard parameter may be passed to RoleMiddleware, PermissionMiddleware, and RoleOrPermissionMiddleware. See #1565 Thanks @lloricode
    Source code(tar.gz)
    Source code(zip)
  • 3.16.0(Aug 18, 2020)

  • 3.15.0(Aug 15, 2020)

  • 3.14.0(Aug 15, 2020)

Owner
Spatie
We create open source, digital products and courses for the developer community
Spatie
Laravel Users | A Laravel Users CRUD Management Package

A Users Management Package that includes all necessary routes, views, models, and controllers for a user management dashboard and associated pages for managing Laravels built in user scaffolding. Built for Laravel 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 6.0, 7.0 and 8.0.

Jeremy Kenedy 389 Sep 19, 2022
A Laravel Admin Starter project with Page Builder, Roles, Impersonation, Analytics, Blog, News, Banners, FAQ, Testimonials and more

Laravel CMS Starter Project A Laravel CMS Starter project with AdminLTE theme and core features. Preview project here User: [email protected]

Ben-Piet O'Callaghan 305 Sep 26, 2022
Proyecto Start-Basic sobre Login y crud de usuarios, mediante Api Rest, usando la plantilla AdminLte 3.1 y manejo de roles y permisos con spatie y autenticacion JWT

Proyecto Start-Basic sobre Login y crud de usuarios, mediante Api Rest, usando la plantilla AdminLte 3.1 y manejo de roles y permisos con spatie y autenticacion JWT

null 9 Jul 5, 2022
A quiz application with laravel 8, spatie permissions, livewire, jetstream, chartjs, tailwindcss and more!

Todo Currently busy with some other important things, will definately would like to imporove the app with 1. Multiple choices selection and mapping to

Baig 61 Sep 21, 2022
A PocketMine plugin to create custom ranks and permissions manager!

Ranks A PocketMine plugin to create custom ranks and permissions manager! ##Commands Command Usage Example /rank add - adds ranks! /rank add <rank_nam

DevilDev 4 Apr 6, 2022
Entrust is a succinct and flexible way to add Role-based Permissions to Laravel 5.

ENTRUST (Laravel 5 Package) Entrust is a succinct and flexible way to add Role-based Permissions to Laravel 5. If you are looking for the Laravel 4 ve

Zizaco 6.1k Sep 16, 2022
Laravel Backend API for the tutorial (Granular permissions with Laravel APIs & React frontend)

Laravel Granular Permissions Backend Getting Started Clone the repository. Install the dependencies composer install Update .env database credentials

Munaf Aqeel Mahdi 4 May 10, 2022
Worlds (soon to be) most advanced Anime site! Featuring Administration features and everything you need for users and yourself. The successor of aniZero.

/**********************************************************************\ | _____ H33Tx & xHENAI __ 31.01.2022| |

HENAI.eu 33 Sep 19, 2022
Talk is a real-time users messaging and chatting system Laravel.

Laravel-Talk Talk is a Laravel 5 based user conversation (inbox) system with realtime messaging. You can easily integrate this package with any Larave

Nahid Bin Azhar 1.5k Sep 22, 2022
Your users do not always report errors, LaraBug does. LaraBug is a simple to use and implement error tracker built for the Laravel framework.

Your users do not always report errors, LaraBug does. LaraBug is a simple to use and implement error tracker built for the Laravel framework. This rep

LaraBug 194 Sep 14, 2022
Laravel plugin to track your users logins and alert when a suspicious login occurs

Laravel Suspicious Logins Detect suspicious logins for standard Laravel authentication (base Laravel, Jetstream, etc) and notify a list of administrat

Advent Development 74 May 1, 2022
Laravel 5 Package to Detect Users Browsers, Devices, Languages and Operating Systems

laravel-identify Laravel 5 Package to identify a User's Browser, Operating System, Language and Device Installation PHP 7.1+ or HHVM 3.3+, and Compose

Prosper Otemuyiwa 186 Jul 17, 2022
Laravel Impersonate is a plugin that allows you to authenticate as your users.

Laravel Impersonate Laravel Impersonate makes it easy to authenticate as your users. Add a simple trait to your user model and impersonate as one of y

404lab 1.5k Sep 24, 2022
A simple Content Moderation System for Laravel 5.* that allows you to Approve or Reject resources like posts, comments, users, etc.

Laravel Moderation A simple Moderation System for Laravel 5.* that allows you to Approve or Reject resources like posts, comments, users, etc. Keep yo

Alex Kyriakidis 509 Aug 15, 2022
Prevent users from reusing recently used passwords

Laravel Password History Validation Prevent users from reusing recently used passwords. Installation You can install the package via composer: compose

Paul Edward 68 Jul 17, 2022
The api help to manage wso2 users from laravel application

Laravel WSO2 Identity API User This is a Laravel library to manage WSO2 IDP users. Installation You can install the package via composer: composer req

Kalyan Halder Raaz 2 Dec 12, 2021
Laravel package for giving admin-created accounts to users via 'set-password' email.

Invytr When making a website where users are created instead of registering themselves, you are faced with the challenge of safely giving users the ac

GlaivePro 64 Jul 17, 2022
Allow your users to login with FaceID/TouchID

Allow your users to login with FaceID/TouchID Allow your users to register physical authentication devices (FaceID or TouchID on iPhones & macs, finge

Miguel Piedrafita 872 Sep 26, 2022
A Laravel 5.1 ORM example with Nerds as users.

laravel-nerds A Laravel 5.1 ORM example with Nerds as users. App Features Show all Nerds Add a Nerd Edit a Nerd Delete a Nerd Keeps Nerd's Name Keeps

Jeremy Kenedy 6 Aug 20, 2022