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

@@ -94,6 +94,9 @@ ## Permissions
];
```
**Permissions are auto-loaded!** When you run `php artisan db:seed --class=RolePermissionSeeder`,
it scans all `app/Modules/*/Permissions.php` files and registers them automatically.
Use in Blade:
```blade
@can('stock_management.view')