act-training/laravel-permissions-manager
UUID-ready roles & permissions management UI for Laravel, powered by Spatie Permission + Livewire 3 and FluxUI Pro. Includes CRUD, categories with color badges, protected roles, user assignment safeguards, TableBuilder support, and customizable models/views.
A comprehensive roles and permissions management UI for Laravel applications, built on Spatie Laravel Permission with Livewire 3 and FluxUI Pro components.
Perfect for ACT Training internal applications and any Laravel project requiring a robust, UUID-based permissions management interface.
✅ Complete CRUD for permissions and roles
✅ UUID-based primary keys with Spatie Permission integration
✅ Category-based organization with colour-coded badges
✅ Protected roles that cannot be deleted
✅ User assignment tracking and prevention of deletions
✅ FluxUI Pro components for beautiful UI
✅ TableBuilder integration for powerful tables
✅ Fully customizable views, models, and categories
✅ Comprehensive tests included
composer require act-training/laravel-permissions-manager
# Publish configuration file
php artisan vendor:publish --tag=permissions-manager-config
# Publish migrations
php artisan vendor:publish --tag=permissions-manager-migrations
php artisan migrate
This will add description and category columns to your permissions table, and description and is_protected columns to your roles table.
Create an enum that implements the HasColor contract:
php artisan make:enum PermissionCategoryEnum
<?php
namespace App\Enums;
use ACTTraining\PermissionsManager\Contracts\HasColor;
use Livewire\Wireable;
use Spatie\Enum\Laravel\Enum;
final class PermissionCategoryEnum extends Enum implements HasColor, Wireable
{
protected static function labels(): array
{
return [
'admin' => 'Admin',
'forms' => 'Forms',
'users' => 'Users',
'settings' => 'Settings',
'other' => 'Other',
];
}
public function color(): string
{
return match ($this) {
self::admin() => 'pink',
self::forms() => 'purple',
self::users() => 'orange',
self::settings() => 'red',
self::other() => 'gray',
};
}
}
Edit config/permissions-manager.php to reference your enum:
'category_enum' => App\Enums\PermissionCategoryEnum::class,
In your routes/web.php or a service provider:
use ACTTraining\PermissionsManager\Livewire\PermissionsAndRoles;
Route::middleware(['auth', 'admin'])->group(function () {
Route::get('/admin/permissions-and-roles', PermissionsAndRoles::class)
->name('admin.permissions-and-roles');
});
Add a link to your navigation menu:
<flux:navlist.item icon="shield-check" href="{{ route('admin.permissions-and-roles') }}">
Roles & Permissions
</flux:navlist.item>
The config/permissions-manager.php file provides extensive customization options:
'category_enum' => App\Enums\PermissionCategoryEnum::class,
Specify your custom enum class. Must implement ACTTraining\PermissionsManager\Contracts\HasColor.
'models' => [
'permission' => ACTTraining\PermissionsManager\Models\Permission::class,
'role' => ACTTraining\PermissionsManager\Models\Role::class,
'user' => App\Models\User::class,
],
Override default models with your own implementations if needed.
'guard' => [
'show_selection' => env('PERMISSIONS_SHOW_GUARD', false),
'default' => 'web',
'available_guards' => ['web', 'api'],
],
Control guard visibility in the UI. When show_selection is false, the guard field is hidden and default is used automatically.
'protected_roles' => [
'Admin',
'Basic',
],
List role names that cannot be deleted. These roles are critical to system functionality.
'pagination' => [
'permissions_per_page' => 6,
'roles_per_page' => null, // null = show all roles on one page
],
Configure pagination for permissions and roles lists.
'features' => [
'category_filtering' => true,
],
Enable/disable category filtering in the role editor.
Visit /admin/permissions-and-roles (or your configured route) to access the permissions manager interface.
Use the action menu (⋮) on each row to edit or delete permissions/roles.
Note: Protected roles cannot be deleted, and roles/permissions assigned to users cannot be deleted until unassigned.
To customize the UI, publish the views:
php artisan vendor:publish --tag=permissions-manager-views
Views will be published to resources/views/vendor/permissions-manager/.
Create your own models that extend the package models:
<?php
namespace App\Models;
use ACTTraining\PermissionsManager\Models\Permission as BasePermission;
class Permission extends BasePermission
{
// Add custom methods or relationships here
}
Then update config/permissions-manager.php:
'models' => [
'permission' => App\Models\Permission::class,
// ...
],
The package uses ACT Training's QueryBuilder package for tables. You can override column components by publishing views.
The package includes a comprehensive test suite using PHPUnit.
composer test
Extend the package's TestCase:
<?php
namespace Tests\Feature;
use ACTTraining\PermissionsManager\Tests\TestCase;
class PermissionsTest extends TestCase
{
public function test_can_create_permission()
{
// Your test here
}
}
Clone the repository and install dependencies:
git clone https://github.com/act-training/laravel-permissions-manager.git
cd laravel-permissions-manager
composer install
vendor/bin/phpunit
Error: Class 'Flux\Flux' not found
Solution: Ensure FluxUI Pro is installed:
composer require livewire/flux-pro
Error: Class 'ACTTraining\QueryBuilder\TableBuilder' not found
Solution: Install the QueryBuilder package:
composer require act-training/query-builder:dev-88-add-groupby-to-report-builder
Error: Primary key not found
Solution: Ensure Spatie Permission is configured for UUID:
// config/permission.php
'column_names' => [
'model_morph_key' => 'model_uuid',
],
See CHANGELOG.md for version history.
This is an internal ACT Training package. Contributions from team members are welcome!
MIT License - see LICENSE file for details.
For ACT Training team members, reach out in the #development Slack channel.
For issues, please create a GitHub issue in the repository.
How can I help you explore Laravel packages today?