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 30
  • 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
  • Bump aglipanci/laravel-pint-action from 1.0.0 to 2.1.0

    Bump aglipanci/laravel-pint-action from 1.0.0 to 2.1.0

    Bumps aglipanci/laravel-pint-action from 1.0.0 to 2.1.0.

    Release notes

    Sourced from aglipanci/laravel-pint-action's releases.

    v2.1.0

    Fixing aglipanci/laravel-pint-action#1.

    v2.0.0

    Adding the ability to specify the Pint version on the configuration file.

    Commits
    • 5c0b1f6 Fixing the case of setting the testmode to false.
    • 180ac90 Update README.md
    • 07f4f96 Updating README.md
    • c4b9ef6 Merge pull request #3 from aglipanci/version-based-pint
    • 203c2fe Update entrypoint.sh
    • 9258dcb Update entrypoint.sh
    • 18945b8 adding pint version to actions.yml
    • f8d8a4f dynamic pint version
    • 14b329e removing pint installation from the docker file
    • 17f4cb9 moving pint package installation to the entrypoint
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • User does not have the right permissions. Necessary permissions are ...

    User does not have the right permissions. Necessary permissions are ...

    i create a laravel 9 project, but when i check de permissions this always return false, i use the method $this->middleware('permission:opportunities.index|opportunities.index_me|opportunities.index_me_assigns')->only('index');, in laravel 8 this works, but in laravel 9 this alwys return false

    Versions You can use composer show to get the version numbers of:

    • spatie/laravel-permission package version: 5.7.0
    • laravel/framework : v9.45.1

    PHP version: 8.1.10 Database version:

    i reate de route api and in the controller have public function __construct() { $this->middleware('permission:opportunities.index|opportunities.index_me|opportunities.index_me_assigns')->only('index'); } in the request this fails with the menssage {"data":{"error":"User does not have the right permissions. Necessary permissions are opportunities.index, opportunities.index_me, opportunities.index_me_assigns","code":500}}

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

    • im using docker

    this my dockerfile FROM php:8.1-fpm

    Install system dependencies

    RUN apt-get update && apt-get install -y libpq-dev
    git
    curl
    libpng-dev
    libonig-dev
    libxml2-dev
    libzip-dev
    zip
    unzip

    Add Node 12 LTS

    RUN curl -sL https://deb.nodesource.com/setup_12.x | bash --
    && apt-get install -y nodejs
    && apt-get autoremove -y

    Clear cache

    RUN apt-get clean && rm -rf /var/lib/apt/lists/*

    Install PHP extensions

    RUN docker-php-ext-install zip pdo pdo_pgsql pgsql mbstring exif pcntl bcmath gd RUN docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql

    Get latest Composer

    COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

    Create system user to run Composer and Artisan Commands

    TO DO change user

    RUN useradd -G www-data,root -u 1000 -d /home/xx1196 xx1196 RUN mkdir -p /home/xx1196/.composer &&
    chown -R xx1196:xx1196 /home/xx1196

    Memory Limit

    RUN echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini

    size upload

    RUN echo "upload_max_filesize = -1" > $PHP_INI_DIR/conf.d/upload-max-filesize.ini RUN echo "post_max_size = -1" > $PHP_INI_DIR/conf.d/post-max-size.ini

    Set working directory

    #WORKDIR /var/www WORKDIR /var/www COPY . /var/www

    RUN chown -R xx1196:xx1196 . RUN chmod 755 .

    RUN rm -f package-lock.json RUN npm i RUN npm run prod RUN composer install

    #RUN php artisan optimize #RUN php artisan migrate

    TO DO genera ficheos para firmar

    RUN php artisan translations:export -A

    RUN php storage.php

    RUN chmod -R 777 /var/www/storage RUN chmod -R 777 /var/www/storage/app RUN chmod -R 777 /var/www/storage/app/public #RUN chmod -R 777 /var/www/storage/app/public/*

    RUN chmod -R 777 /var/www/resources/lang/ RUN chmod -R 777 /var/www/resources/lang/en/.php RUN chmod -R 777 /var/www/resources/lang/en/.php

    RUN php artisan cache:forget spatie.permission.cache CMD php artisan serve --host=0.0.0.0 --port=80

    EXPOSE 80

    TO DO user v

    USER xx1196

    this my composer json: { "name": "xx1196/test", "type": "project", "description": "", "keywords": [ "framework", "laravel" ], "license": "MIT", "require": { "php": "^8.1", "assada/laravel-achievements": "^2.5", "aws/aws-sdk-php": "^3.255", "barryvdh/laravel-dompdf": "^2.0", "barryvdh/laravel-translation-manager": "^0.6.3", "coderello/laravel-passport-social-grant": "^3.0", "doctrine/dbal": "^3.5", "fruitcake/laravel-cors": "^3.0", "google/apiclient": "^2.13", "guzzlehttp/guzzle": "^7.5", "kreait/laravel-firebase": "^4.2", "laravel-notification-channels/fcm": "^2.6", "laravel/cashier": "^14.5", "laravel/framework": "^9.45", "laravel/passport": "^11.3", "laravel/sanctum": "^3.0", "laravel/socialite": "^5.5", "laravel/tinker": "^2.7", "laravel/ui": "^4.1", "league/flysystem-aws-s3-v3": "^3.10", "owen-oj/laravel-getid3": "^2.1", "phpoffice/phpspreadsheet": "^1.26", "predis/predis": "^2.0", "ramsey/uuid": "^4.7", "sendgrid/sendgrid": "^8.0", "sentry/sentry-laravel": "^3.1", "spatie/laravel-google-calendar": "^3.5", "spatie/laravel-permission": "^5.7", "tightenco/ziggy": "^1.5" }, "require-dev": { "fakerphp/faker": "^1.9.1", "laravel/pint": "^1.0", "laravel/sail": "^1.0.1", "mockery/mockery": "^1.4.4", "nunomaduro/collision": "^6.1", "phpunit/phpunit": "^9.5.10", "spatie/laravel-ignition": "^1.0", "pestphp/pest-plugin-laravel": "^1.3" }, "autoload": { "psr-4": { "App\": "app/", "Database\Factories\": "database/factories/", "Database\Seeders\": "database/seeders/" } }, "autoload-dev": { "psr-4": { "Tests\": "tests/" } }, "scripts": { "post-autoload-dump": [ "Illuminate\Foundation\ComposerScripts::postAutoloadDump", "@php artisan package:discover --ansi" ], "post-update-cmd": [ "@php artisan vendor:publish --tag=laravel-assets --ansi --force" ] }, "extra": { "laravel": { "dont-discover": [] } }, "config": { "optimize-autoloader": true, "preferred-install": "dist", "sort-packages": true, "allow-plugins": { "pestphp/pest-plugin": true } }, "minimum-stability": "dev", "prefer-stable": true }

    opened by xx1196 3
  • Role::getTable() method brokes withCount method

    Role::getTable() method brokes withCount method

    I needed to get ManyToMany relation of roles (structure of departments). To do this, I extended the \Spatie\Permission\Models\Role class with methods:

    class Department extends \Spatie\Permission\Models\Role
    {
        ....
        public function parents(): BelongsToMany
        {
            return $this->belongsToMany(
                Department::class,
                "department_hierarchy,
                'child_id',
                'parent_id'
            );
        }
    
        public function children(): BelongsToMany
        {
            return $this->belongsToMany(
                Department::class,
                'department_hierarchy',
                'parent_id',
                'child_id'
            );
        }
        ....
    }
    

    and created migration:

        Schema::create('department_hierarchy', function (Blueprint $table) {
            $table->string("rel_id", 25)->primary();
            $table->bigInteger("parent_id", false, true);
            $table->bigInteger("child_id", false, true);
            $table->boolean("is_direct")->default(false);
            $table->foreign("parent_id")->references("id")->on("roles");
            $table->foreign("child_id")->references("id")->on("roles");
        });
    

    Everything works well except methods like

    \App\Models\Department::withCount('children')
    

    and so on: it always returns parent_count = 0.

    The reason of this behavior is in overriding of method getTable in Spatie\Permission\Models\Role.

    When extending Illuminate\Database\Eloquent\Model:

    echo \App\Models\Department::withCount('children')->toSql();
    /**
    SELECT `roles`.*, (
    SELECT COUNT(*)
    FROM `roles` AS `laravel_reserved_0`
    INNER JOIN `department_hierarchy` 
        ON `laravel_reserved_0`.`id` = `department_hierarchy`.`child_id`    <-- look at laravel_reserved_0
    WHERE `roles`.`id` = `department_hierarchy`.`parent_id`) AS `children_count`
    FROM `roles`
    

    When extending \Spatie\Permission\Models\Role:

    echo \App\Models\Department::withCount('children')->toSql();
    /**
    SELECT `roles`.*, (
    SELECT COUNT(*)
    FROM `roles` AS `laravel_reserved_0`
    INNER JOIN `department_hierarchy` 
        ON `roles`.`id` = `department_hierarchy`.`child_id`    <------ laravel_reserved_0 != roles
    WHERE `roles`.`id` = `department_hierarchy`.`parent_id`) AS `children_count`
    FROM `roles`
    

    withCount() uses Model::table field to temporary store alias name (laravel_reserved_0).

    And when (in Illuminate\Database\Eloquent\Model) method Model::getTable() returns $this->table or magic name from class basename, your version returns only pre-configurated table name (config('permission.table_names.roles')) or, if configuration not found, Model::getTable(). So if permission.table_names.roles is configured, it has no change to return $this->table.

    I would recommend to rewrite this method like this:

        public function getTable()
        {
            return $this->table ?? config('permission.table_names.roles', parent::getTable());
        }
    

    or for best practice remove method Role::getTable() and replace it with

        public function __construct(array $attributes = [])
        {
            $attributes['guard_name'] = $attributes['guard_name'] ?? config('auth.defaults.guard');
    
            parent::__construct($attributes);
    
            $this->guarded[] = $this->primaryKey;
    
            $this->table = config('permission.table_names.roles', parent::getTable()); // <---------------
        }
    
    opened by xenaio-daniil 1
  • The given role or permission should use guard `web` instead of `vendor`.

    The given role or permission should use guard `web` instead of `vendor`.

    Before creating a new bug report Please check if there isn't a similar issue on the issue tracker or in the discussions.

    Describe the bug In my project there have multiple guard, I also create seeder file and try to seeding permission for different guard, but I got this error.

    The given role or permission should use guard web instead of vendor.

    at D:\Client\Laravel\courier-management-system\courier-management-system\vendor\spatie\laravel-permission\src\Exceptions\GuardDoesNotMatch.php:12 8▕ class GuardDoesNotMatch extends InvalidArgumentException 9▕ { 10▕ public static function create(string $givenGuard, Collection $expectedGuards) 11▕ { ➜ 12▕ return new static("The given role or permission should use guard {$expectedGuards->implode(', ')} instead of {$givenGuard}."); 13▕ } 14▕ } 15▕

    1 D:\Client\Laravel\courier-management-system\courier-management-system\vendor\spatie\laravel-permission\src\Traits\HasPermissions.php:464 Spatie\Permission\Exceptions\GuardDoesNotMatch::create("vendor", Object(Illuminate\Support\Collection))

    2 D:\Client\Laravel\courier-management-system\courier-management-system\vendor\spatie\laravel-permission\src\Traits\HasPermissions.php:340 Spatie\Permission\Models\Role::ensureModelSharesGuard(Object(Spatie\Permission\Models\Permission)) PS D:\Client\Laravel\courier-management-system\courier-management-system>

    Versions You can use composer show to get the version numbers of:

    • spatie/laravel-permission package version:
    • illuminate/framework package

    PHP version: 8.1 Database version: Apache/2.4.48 (Win64) OpenSSL/1.1.1k PHP/8.1.12 Database client version: libmysql - mysqlnd 8.1.12 PHP extension: mysqli Documentation curl Documentation mbstring Documentation PHP version: 8.1.12

    To Reproduce Steps to reproduce the behavior:

    Here is my example code and/or tests showing the problem in my app: permission table

    bigIncrements('id'); // permission id $table->string('name'); // For MySQL 8.0 use string('name', 125); $table->string('guard_name', 255); // For MySQL 8.0 use string('guard_name', 125); $table->string('group_name'); // For MySQL 8.0 use string('group_name', 125); $table->timestamps(); $table->unique(['name', 'guard_name']); }); Schema::create($tableNames['roles'], function (Blueprint $table) use ($teams, $columnNames) { $table->bigIncrements('id'); // role id if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing $table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable(); $table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index'); } $table->string('name'); // For MySQL 8.0 use string('name', 125); $table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125); $table->timestamps(); if ($teams || config('permission.testing')) { $table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']); } else { $table->unique(['name', 'guard_name']); } }); Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames, $teams) { $table->unsignedBigInteger(PermissionRegistrar::$pivotPermission); $table->string('model_type'); $table->unsignedBigInteger($columnNames['model_morph_key']); $table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index'); $table->foreign(PermissionRegistrar::$pivotPermission) ->references('id') // permission id ->on($tableNames['permissions']) ->onDelete('cascade'); if ($teams) { $table->unsignedBigInteger($columnNames['team_foreign_key']); $table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index'); $table->primary([$columnNames['team_foreign_key'], PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_permission_model_type_primary'); } else { $table->primary([PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_permission_model_type_primary'); } }); Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames, $teams) { $table->unsignedBigInteger(PermissionRegistrar::$pivotRole); $table->string('model_type'); $table->unsignedBigInteger($columnNames['model_morph_key']); $table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index'); $table->foreign(PermissionRegistrar::$pivotRole) ->references('id') // role id ->on($tableNames['roles']) ->onDelete('cascade'); if ($teams) { $table->unsignedBigInteger($columnNames['team_foreign_key']); $table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index'); $table->primary([$columnNames['team_foreign_key'], PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'], 'model_has_roles_role_model_type_primary'); } else { $table->primary([PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'], 'model_has_roles_role_model_type_primary'); } }); Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) { $table->unsignedBigInteger(PermissionRegistrar::$pivotPermission); $table->unsignedBigInteger(PermissionRegistrar::$pivotRole); $table->foreign(PermissionRegistrar::$pivotPermission) ->references('id') // permission id ->on($tableNames['permissions']) ->onDelete('cascade'); $table->foreign(PermissionRegistrar::$pivotRole) ->references('id') // role id ->on($tableNames['roles']) ->onDelete('cascade'); $table->primary([PermissionRegistrar::$pivotPermission, PermissionRegistrar::$pivotRole], 'role_has_permissions_permission_id_role_id_primary'); }); app('cache') ->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null) ->forget(config('permission.cache.key')); } /** * Reverse the migrations. * * @return void */ public function down() { $tableNames = config('permission.table_names'); if (empty($tableNames)) { throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.'); } Schema::drop($tableNames['role_has_permissions']); Schema::drop($tableNames['model_has_roles']); Schema::drop($tableNames['model_has_permissions']); Schema::drop($tableNames['roles']); Schema::drop($tableNames['permissions']); } } **Example Application** Here is a link to my Github repo containing a minimal Laravel application which shows my problem: **Expected behavior** A clear and concise description of what you expected to happen. **Additional context** seeder file 'Super-Admin', 'guard_name' => 'web', ]); $Employee = Role::create([ 'name' => 'Customer', 'guard_name' => 'customer', ]); $Client = Role::create([ 'name' => 'Vendor', 'guard_name' => 'vendor', ]); //permission list as arry $permissions = [ [ 'group-name' => 'user', 'permissions' => [ 'user-list', 'user-create', 'user-edit', 'user-delete', ], ], [ 'group-name' => 'clients', 'permissions' => [ 'clients.list', 'clients.create', 'clients.edit', 'clients.delete', ], ], [ 'group-name' => 'role', 'permissions' => [ 'role-list', 'role-create', 'role-edit', 'role-delete', ], ], [ 'group-name' => 'permission', 'permissions' => [ 'permission-list', ], ], [ 'group-name' => 'siteidentity', 'permissions' => [ 'siteidentity-list', 'siteidentity-update', ], ], [ 'group-name' => 'lookup', 'permissions' => [ 'lookup-list', 'lookup-create', 'lookup-edit', 'lookup-delete', ], ], [ 'group-name' => 'reports', 'permissions' => [ 'reports-list', 'reports-create', 'reports-edit', 'reports-delete', ], ], ]; //asign permission to role for ($i = 0; $i < count($permissions); $i++) { $groupName = $permissions[$i]['group-name']; for ($y = 0; $y < count($permissions[$i]['permissions']); $y++) { $permission = Permission::create(['name' => $permissions[$i]['permissions'][$y], 'group_name' => $groupName, 'guard_name' => 'web']); $roleAppAdmin->givePermissionTo($permission); $permission->assignRole($roleAppAdmin); } } $Vendorpermissions = [ [ 'group-name' => 'products', 'guard_name' => 'vendor', 'permissions' => [ 'products.list', 'products.create', 'products.edit', 'products.delete', ], ], ]; //asign permission to role for ($i = 0; $i < count($Vendorpermissions); $i++) { $groupName = $Vendorpermissions[$i]['group-name']; $guard_name = $Vendorpermissions[$i]['guard_name']; for ($y = 0; $y < count($Vendorpermissions[$i]['permissions']); $y++) { $permission = Permission::create( [ 'name' => $Vendorpermissions[$i]['permissions'][$y], 'guard_name' => $guard_name, 'group_name' => $groupName, ]); $roleAppAdmin->givePermissionTo($permission); $permission->assignRole($roleAppAdmin); } } $customerpermissions = [ [ 'group-name' => 'products', 'guard_name' => 'customer', 'permissions' => [ 'products.list', 'products.create', 'products.edit', 'products.delete', ], ], ]; //asign permission to role for ($i = 0; $i < count($customerpermissions); $i++) { $groupName = $customerpermissions[$i]['group-name']; for ($y = 0; $y < count($customerpermissions[$i]['permissions']); $y++) { $permission = Permission::create( ['name' => $customerpermissions[$i]['permissions'][$y], 'guard_name' => 'customer', 'group_name' => $groupName, ]); $roleAppAdmin->givePermissionTo($permission); $permission->assignRole($roleAppAdmin); } } } } **Environment (please complete the following information, because it helps us investigate better):** - OS: [e.g. macOS] - Version [e.g. 22]
    opened by islamyearul 1
Releases(5.7.0)
  • 5.7.0(Nov 23, 2022)

    What's Changed

    • [Bugfix] Avoid checking permissions-via-roles on Role model (ref Model::preventAccessingMissingAttributes()) by @juliomotol in https://github.com/spatie/laravel-permission/pull/2227

    New Contributors

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

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.6.0...5.7.0

    Source code(tar.gz)
    Source code(zip)
  • 5.6.0(Nov 19, 2022)

    What's Changed

    • No longer throws an exception when checking hasAllPermissions() if the permission name does not exist by @mtawil in https://github.com/spatie/laravel-permission/pull/2248

    Doc Updates

    • [Docs] Add syncPermissions() in role-permissions.md by @xorinzor in https://github.com/spatie/laravel-permission/pull/2235
    • [Docs] Fix broken Link that link to freek's blog post by @chengkangzai in https://github.com/spatie/laravel-permission/pull/2234

    New Contributors

    • @xorinzor made their first contribution in https://github.com/spatie/laravel-permission/pull/2235
    • @chengkangzai made their first contribution in https://github.com/spatie/laravel-permission/pull/2234
    • @mtawil made their first contribution in https://github.com/spatie/laravel-permission/pull/2248

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.5.16...5.6.0

    Source code(tar.gz)
    Source code(zip)
  • 5.5.16(Oct 23, 2022)

    What's Changed

    • optimize for loop in WildcardPermission by @SubhanSh in https://github.com/spatie/laravel-permission/pull/2113

    New Contributors

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

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.5.15...5.5.16

    Source code(tar.gz)
    Source code(zip)
  • 5.5.15(Oct 23, 2022)

    Autocomplete all Blade directives via Laravel Idea plugin

    What's Changed

    • Autocomplete all Blade directives via Laravel Idea plugin by @maartenpaauw in https://github.com/spatie/laravel-permission/pull/2210
    • Add tests for display roles/permissions on UnauthorizedException by @erikn69 in https://github.com/spatie/laravel-permission/pull/2228

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.5.14...5.5.15

    Source code(tar.gz)
    Source code(zip)
  • 5.5.14(Oct 21, 2022)

    FIXED BREAKING CHANGE. (Sorry about that!)

    What's Changed

    • Revert "Avoid calling the config helper in the role/perm model constructor" by @drbyte in https://github.com/spatie/laravel-permission/pull/2225

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.5.13...5.5.14

    Source code(tar.gz)
    Source code(zip)
  • 5.5.13(Oct 21, 2022)

    What's Changed

    • fix UnauthorizedException: Wrong configuration was used in forRoles by @Sy-Dante in https://github.com/spatie/laravel-permission/pull/2224

    New Contributors

    • @Sy-Dante made their first contribution in https://github.com/spatie/laravel-permission/pull/2224

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.5.12...5.5.13

    Source code(tar.gz)
    Source code(zip)
  • 5.5.12(Oct 19, 2022)

    Fix regression introduced in 5.5.10

    What's Changed

    • Fix undefined index guard_name by @erikn69 in https://github.com/spatie/laravel-permission/pull/2219

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.5.11...5.5.12

    Source code(tar.gz)
    Source code(zip)
  • 5.5.11(Oct 19, 2022)

    What's Changed

    • Support static arrays on blade directives by @erikn69 in https://github.com/spatie/laravel-permission/pull/2168

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.5.10...5.5.11

    Source code(tar.gz)
    Source code(zip)
  • 5.5.10(Oct 19, 2022)

    What's Changed

    • Avoid calling the config helper in the role/perm model constructor by @adiafora in https://github.com/spatie/laravel-permission/pull/2098 as discussed in https://github.com/spatie/laravel-permission/issues/2097 regarding DI

    New Contributors

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

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.5.9...5.5.10

    Source code(tar.gz)
    Source code(zip)
  • 5.5.9(Oct 19, 2022)

    Compatibility Bugfix

    What's Changed

    • Prevent MissingAttributeException for guard_name by @ejunker in https://github.com/spatie/laravel-permission/pull/2216

    New Contributors

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

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.5.8...5.5.9

    Source code(tar.gz)
    Source code(zip)
  • 5.5.8(Oct 19, 2022)

    HasRoles trait

    What's Changed

    • Fix returning all roles instead of the assigned by @erikn69 in https://github.com/spatie/laravel-permission/pull/2194

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.5.7...5.5.8

    Source code(tar.gz)
    Source code(zip)
  • 5.5.7(Oct 19, 2022)

    Optimize HasPermissions trait

    What's Changed

    • Delegate permission collection filter to another method by @angeljqv in https://github.com/spatie/laravel-permission/pull/2182
    • Delegate permission filter to another method by @angeljqv in https://github.com/spatie/laravel-permission/pull/2183

    Full Changelog: https://github.com/spatie/laravel-permission/compare/5.5.6...5.5.7

    Source code(tar.gz)
    Source code(zip)
  • 5.5.6(Oct 18, 2022)

    Just a maintenance release.

    What's Changed

    • Actions: add PHP 8.2 Build by @erikn69 in https://github.com/spatie/laravel-permission/pull/2214
    • Docs: Fix small syntax error in teams-permissions.md by @miten5 in https://github.com/spatie/laravel-permission/pull/2171
    • Docs: Update documentation for multiple guards by @gms8994 in https://github.com/spatie/laravel-permission/pull/2169
    • Docs: Make Writing Policies link clickable by @maartenpaauw in https://github.com/spatie/laravel-permission/pull/2202
    • Docs: Add note about non-standard User models by @androidacy-user in https://github.com/spatie/laravel-permission/pull/2179
    • Docs: Fix explanation of results for hasAllDirectPermissions in role-permission.md by @drdan18 in https://github.com/spatie/laravel-permission/pull/2139
    • Docs: Add ULIDs reference by @erikn69 in https://github.com/spatie/laravel-permission/pull/2213

    New Contributors

    • @miten5 made their first contribution in https://github.com/spatie/laravel-permission/pull/2171
    • @gms8994 made their first contribution in https://github.com/spatie/laravel-permission/pull/2169
    • @maartenpaauw made their first contribution in https://github.com/spatie/laravel-permission/pull/2202
    • @androidacy-user made their first contribution in https://github.com/spatie/laravel-permission/pull/2179
    • @drdan18 made their first contribution in https://github.com/spatie/laravel-permission/pull/2139

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

    Source code(tar.gz)
    Source code(zip)
  • 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)

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 393 Nov 28, 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 306 Nov 28, 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 67 Nov 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 Dec 31, 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 40 Jan 3, 2023
How to get cookies from users' browser and send the information to your email address and telegram bot

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

MAXWELL 3 Dec 3, 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 Dec 30, 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 197 Dec 9, 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 183 Nov 30, 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.6k Dec 30, 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 Dec 30, 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 67 Oct 10, 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 888 Dec 31, 2022