Roles and permissions for Laravel users, stored in the database
open sourceMITfree
Laravel Permission is Spatie's package for associating users with roles and permissions stored in the database. Permissions can be given to a user directly or through roles, and every permission is registered on Laravel's gate, so the framework's own can checks, policies and Blade @can directives work with them. It has separate sets of roles and permissions for each auth guard, team-scoped permissions, wildcard permissions, enums, middleware and Artisan commands, and caches permissions between requests.
Problems it solves
- give users roles like admin and editor in my Laravel app
- check whether a user can edit articles in Laravel without writing my own tables
- store which users can do what in the database for a Laravel API
Features
- permissions given directly or through roles
- works with Laravel's gate, policies and Blade @can
- separate roles and permissions for each guard
- team-scoped and wildcard permissions
- middleware, Artisan commands and a permission cache
