feat: Add idempotent RolesAndPermissionsSeeder for RBAC Phase 4 #150
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
π― Objective
Implement idempotent seeder for predefined roles and permissions (RBAC Phase 4).
π Changes
Seeder Implementation
RolesAndPermissionsSeeder.phpwith idempotentfirstOrCreate()patternguard_name='sanctum'to all Permission and Role creationpermissions.assign_directandpermissions.revoke_directDatabaseSeeder.phpcall chainPredefined Roles (5)
Permission Groups (37 total)
read,create,update,delete,read_salary,read_all_branches,exportread,create,update,delete,publish,approve_as_brread,create,update,delete,publish,acknowledge,view_acknowledgmentsread,create,update,delete,assign_temporary,extend_expirationread,create,update,delete,assign_direct,revoke_directaccess_employee_files,approve_shift_plansgenerate,view,exportIdempotency Testing
Role::count() === 5Permission::count() === 37guard_name='sanctum'guard_name='sanctum'π§ͺ Quality Gates
β Acceptance Criteria
guard_name='sanctum'guard_name='sanctum'π Test Results
π Related Issues
Fixes #139
Part of #108 - RBAC Phase 4
π Review Checklist
firstOrCreate()everywheresanctum) for all permissionssanctum) for all rolesresource.actionconventionType: Database / RBAC
Size: ~6 LOC changed
Risk: Low (data seeding, idempotent design)