lathe / permission
Roles and permissions for Lathe, built on spatie/laravel-permission.
Requires
- php: ^8.4
- lathe/lathe: ^1.0
- spatie/laravel-permission: ^7.0 || ^8.0
Requires (Dev)
- larastan/larastan: ^3.13
- laravel/pint: ^1.25
- orchestra/testbench: ^11.3
- pestphp/pest: ^5.3
- pestphp/pest-plugin-laravel: ^5.0
- pestphp/pest-plugin-type-coverage: ^5.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-15 13:09:05 UTC
README
Roles and permissions from spatie/laravel-permission, managed in the Lathe panel.
Install
composer require lathe/permission:^1.0@beta
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"
php artisan migrate
Add Spatie\Permission\Traits\HasRoles to your User model. Lathe discovers the plugin from the package's composer.json, so there is no registration step.
Opt in
Nobody may manage roles or permissions until the app opts in. Register the plugin with the shipped policies, which let every user who passes viewLathe manage both and log one boot warning per policy class:
Lathe::registerPlugins(PermissionPlugin::make()->withDefaultPolicies());
Or register your own policies:
Lathe::registerPlugins( PermissionPlugin::make() ->useRolePolicy(RolePolicy::class) ->usePermissionPolicy(PermissionPolicy::class), );
A plugin you register by hand wins over the discovered one. useRoleResource() and usePermissionResource() swap in your own Resources.
Cache
Saving or deleting a role or a permission flushes Spatie's permission cache, so a change made in the panel applies on the next request.
Known limits
- A host table named
rolesorpermissionscollides with Spatie's tables. - A host Resource with the uriKey
rolesorpermissionsstops the panel from booting withResourceUriKeyCollisionException. Point the plugin at it withuseRoleResource()orusePermissionResource().
Development
This repository is a read-only copy of plugins/permission in lathephp/lathe, where the plugin is developed and released together with Lathe. Send issues and pull requests there.
To run the plugin's own checks here:
composer update
composer test
composer analyse
composer lint
composer types
CI runs the tests on PHP 8.4 and 8.5, each on the highest versions and after composer update --prefer-lowest (spatie/laravel-permission 7.x).