Add phone login support and member import functionality
Features: - Support login via phone number or email (LoginRequest) - Add members:import-roster command for Excel roster import - Merge survey emails with roster data Code Quality (Phase 1-4): - Add database locking for balance calculation - Add self-approval checks for finance workflow - Create service layer (FinanceDocumentApprovalService, PaymentVerificationService) - Add HasAccountingEntries and HasApprovalWorkflow traits - Create FormRequest classes for validation - Add status-badge component - Define authorization gates in AuthServiceProvider - Add accounting config file Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,7 @@ trait SeedsRolesAndPermissions
|
||||
{
|
||||
$user = User::factory()->create($attributes);
|
||||
$user->assignRole($role);
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
@@ -34,6 +35,14 @@ trait SeedsRolesAndPermissions
|
||||
return $this->createUserWithRole('admin', $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a secretary general user (first approval stage in new workflow)
|
||||
*/
|
||||
protected function createSecretary(array $attributes = []): User
|
||||
{
|
||||
return $this->createUserWithRole('secretary_general', $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a finance cashier user
|
||||
*/
|
||||
@@ -74,6 +83,32 @@ trait SeedsRolesAndPermissions
|
||||
return $this->createUserWithRole('membership_manager', $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a super admin user (with all permissions)
|
||||
*/
|
||||
protected function createSuperAdmin(array $attributes = []): User
|
||||
{
|
||||
// Create super_admin role if it doesn't exist
|
||||
Role::firstOrCreate(['name' => 'super_admin', 'guard_name' => 'web']);
|
||||
|
||||
// Grant all permissions to super_admin
|
||||
$superAdminRole = Role::findByName('super_admin');
|
||||
$superAdminRole->syncPermissions(Permission::all());
|
||||
|
||||
return $this->createUserWithRole('super_admin', $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a member role user (non-admin member)
|
||||
*/
|
||||
protected function createMemberUser(array $attributes = []): User
|
||||
{
|
||||
// Create member role if it doesn't exist
|
||||
Role::firstOrCreate(['name' => 'member', 'guard_name' => 'web']);
|
||||
|
||||
return $this->createUserWithRole('member', $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a user with specific permissions
|
||||
*/
|
||||
@@ -84,18 +119,21 @@ trait SeedsRolesAndPermissions
|
||||
Permission::findOrCreate($permission, 'web');
|
||||
$user->givePermissionTo($permission);
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all finance approval users (cashier, accountant, chair)
|
||||
* Get all finance approval users for new workflow (secretary, chair, board)
|
||||
*/
|
||||
protected function createFinanceApprovalTeam(): array
|
||||
{
|
||||
return [
|
||||
'secretary' => $this->createSecretary(['email' => 'secretary@test.com']),
|
||||
'chair' => $this->createChair(['email' => 'chair@test.com']),
|
||||
'board_member' => $this->createBoardMember(['email' => 'board@test.com']),
|
||||
'cashier' => $this->createCashier(['email' => 'cashier@test.com']),
|
||||
'accountant' => $this->createAccountant(['email' => 'accountant@test.com']),
|
||||
'chair' => $this->createChair(['email' => 'chair@test.com']),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user