misaf / vendra-permission
Installs: 0
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
Type:vendra-module
pkg:composer/misaf/vendra-permission
Requires
- php: ^8.2
- awcodes/filament-badgeable-column: ^3.0
- filament/filament: ^4.7.0
- illuminate/support: ^11.0|^12.0
- misaf/vendra-activity-log: dev-master
- misaf/vendra-tenant: ^12.0
- misaf/vendra-user: ^12.0
- mokhosh/filament-jalali: ^5.1
- spatie/laravel-package-tools: ^1.92
- spatie/laravel-permission: ^7.0.0
Requires (Dev)
- fakerphp/faker: ^1.24.1
- larastan/larastan: ^3.9.2
- laravel/boost: ^2.0.6
- laravel/pint: ^1.27
- mockery/mockery: ^1.6.12
- nunomaduro/collision: ^8.8.3
- orchestra/testbench: ^10.9
- pestphp/pest: ^4.3.2
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- pestphp/pest-plugin-profanity: ^4.2.1
- pestphp/pest-plugin-type-coverage: ^4.0.3
This package is auto-updated.
Last update: 2026-02-19 15:32:53 UTC
README
Role and permission management for Vendra, built on top of Spatie Permission and Filament 4.
Features
- Filament cluster on the
adminpanel for permission management - Role and permission CRUD resources
- Manage role-permission relations from role pages
- Policy classes and enums for role/permission actions
- Translation files for
enandfa - Configurable
Gate::after()superadmin bypass role
Requirements
- PHP 8.2+
- Laravel 11 or 12
- Filament 4
misaf/vendra-tenantmisaf/vendra-userspatie/laravel-permission
Installation
composer require misaf/vendra-permission
Publish Spatie permission config and migrations (if not already published in your app):
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag=permission-config php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag=permission-migrations php artisan migrate
Optional: publish module translations:
php artisan vendor:publish --tag=vendra-permission-translations
Optional: publish module config:
php artisan vendor:publish --tag=vendra-permission-config
Configuration
If you want Spatie to use this module's models everywhere in your app, set config/permission.php:
'models' => [ 'permission' => Misaf\VendraPermission\Models\Permission::class, 'role' => Misaf\VendraPermission\Models\Role::class, ],
Superadmin bypass role is configurable in config/vendra-permission.php:
'super_admin_role' => env('VENDRA_PERMISSION_SUPER_ADMIN_ROLE', 'superadmin'),
The config key is super_admin_role (short and local to this file).
The env var remains VENDRA_PERMISSION_SUPER_ADMIN_ROLE (prefixed to avoid global collisions).
Filament
Resources are registered on the admin panel through PermissionPlugin:
- Roles
- Permissions
Navigation cluster: permissions
Permission Bulk Actions
AttachRolesAction and DetachRolesAction share role-resolution logic via:
Misaf\VendraPermission\Filament\Clusters\Resources\Permissions\Actions\Concerns\ResolvesSelectedRoles
The trait provides:
getRoleOptions()for the roles multiselect options (name (guard_name))getRolesByGuard()to load selected roles withwhereKey(...)and group byguard_name
This keeps attach/detach behavior consistent and prevents cross-guard role operations when processing selected Permission records.
Usage
Create a role and permission:
use Misaf\VendraPermission\Models\Permission; use Misaf\VendraPermission\Models\Role; $role = Role::query()->create([ 'name' => 'editor', 'guard_name' => 'web', ]); $permission = Permission::query()->create([ 'name' => 'view-any-post', 'guard_name' => 'web', ]); $role->givePermissionTo($permission);
Assign role to a user:
$user->assignRole('editor');
Development
composer test
composer analyse
composer format
Keeping This README Updated
Update this file whenever these change:
composer.jsonrequirements- Filament resources, pages, or cluster names
- Translation keys/files in
resources/lang - Authorization behavior in policies or
PermissionServiceProvider - Installation steps (especially migration/config behavior)
License
MIT. See LICENSE.