Add auto-loading of module permissions in RolePermissionSeeder

RolePermissionSeeder now automatically scans app/Modules/*/Permissions.php
files and registers all permissions found. No manual registration required.

- Added loadModulePermissions() method to scan module directories
- Changed givePermissionTo() to syncPermissions() for idempotency
- Updated Modules README to document auto-loading
- Updated CLAUDE.md to reflect auto-loading behavior
This commit is contained in:
2026-03-11 08:42:06 +02:00
parent 2b153f1759
commit f903914c2b
3 changed files with 49 additions and 6 deletions

View File

@@ -260,7 +260,7 @@ return new class extends Migration
};
```
### 5. Permissions (REQUIRED)
### 5. Permissions (REQUIRED) - AUTO-LOADED
**File**: `src/app/Modules/[ModuleName]/Permissions.php`
@@ -275,6 +275,9 @@ return [
];
```
> **✅ AUTO-LOADED**: `RolePermissionSeeder` automatically scans all `app/Modules/*/Permissions.php`
> files and registers them. Just run `php artisan db:seed --class=RolePermissionSeeder`.
### 6. Filament Resource (REQUIRED for admin)
**File**: `src/app/Modules/[ModuleName]/Filament/Resources/[ModelName]Resource.php`