This is an external open-source GitHub repository imported into the WOCSOL Marketplace for discovery. The original repository owner is the primary creator.
Associate users with roles and permissions
Associate users with roles and permissions
Associate users with permissions and roles [](https://packagist.org/packages/spatie/laravel-permission) [](https://github.com/spatie/laravel-permission/actions?query=workflow%3ATests+branch%3Amain) [](https://packagist.org/packages/spatie/laravel-permission) ## Documentation, Installation, and Usage Instructions See the [documentation](https://spatie.be/docs/laravel-permission/) for detailed instructions for how-to-use, as well as installation and upgrade guidance. ## What It Does This package allows you to manage user permissions and roles in a database. Once installed you can do stuff like this: ```php // 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](https://laravel.com/docs/authorization), you can check if a user has a permission with Laravel's default `can` function: ```php $user->can('edit articles'); ``` ## Support us [ ](https://spatie.be/github-ad-click/laravel-permission) We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us). 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
Ask questions or discuss this product. New comments are reviewed before publishing.
Loading comments...