Installation
Require the package. The service provider and the Permissions facade alias are auto-discovered — no manual registration:
composer require roundly-consulting/permissions-for-laravelPublish the config before anything else. The holder key type is baked into the schema, so decide between bigint, UUID and ULID keys now (see Database schema & key types):
php artisan vendor:publish --tag="permissions-config"Then publish and run the migrations:
php artisan vendor:publish --tag="permissions-migrations"
php artisan migratePublish-only migrations
The package never loads its migrations, so php artisan migrate creates nothing until you have published them into your app’s database/migrations. The five migrations land timestamped and in dependency order — permissions, roles, permission_role, model_roles, model_permissions — and publishing again overwrites them in place rather than adding a second copy.
The only publish tags the package exposes are permissions-config and permissions-migrations.
Next steps
- Add the HasRoles trait to your user model.
- Create your roles and permissions — ideally in an idempotent seeder.
- Protect routes with the native can: middleware.
Show your open-source love
This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.
More ways to support, including cryptoBy donating, you agree to our donation terms.
Want this built into your product?
We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.