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
- PHP 8.2+
- Laravel 12+
- Spatie Laravel Permission 6+
- Livewire 3+
- FluxUI Pro
- ACT Training QueryBuilder package
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-migrationsphp artisan migrateThis 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.
- Click "Create a Permission" button
- Fill in name, description, and category
- Optionally assign to roles
- Click "Save"
- Click "Create a Role" button
- Fill in name and description
- Select permissions (with optional category filtering)
- Click "Save"
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-viewsViews 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 testExtend 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 installvendor/bin/phpunitError: Class 'Flux\Flux' not found
Solution: Ensure FluxUI Pro is installed:
composer require livewire/flux-proError: Class 'ACTTraining\QueryBuilder\TableBuilder' not found
Solution: Install the QueryBuilder package:
composer require act-training/query-builder:dev-88-add-groupby-to-report-builderError: 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!
- Create a feature branch
- Make your changes with tests
- Submit a pull request
MIT License - see LICENSE file for details.
- Built by ACT Training Development Team
- Based on Spatie Laravel Permission
- Uses Livewire and FluxUI Pro
For ACT Training team members, reach out in the #development Slack channel.
For issues, please create a GitHub issue in the repository.