feat: implement comprehensive dashboard controller and modular administrative and project management interfaces
Some checks failed
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled
Tests / PHP 8.5 (push) Has been cancelled

This commit is contained in:
Ajjj
2026-08-03 18:28:52 +08:00
parent 42ba980f7a
commit 936ae1c6b2
48 changed files with 1832 additions and 385 deletions

View File

@@ -97,7 +97,7 @@ class UserController extends Controller
'company_name' => ['nullable', 'string', 'max:255'],
'contact_person' => ['nullable', 'string', 'max:255'],
'tin_number' => ['nullable', 'string', 'max:255'],
'spatie_role' => ['nullable', 'string', Rule::in(['Super Admin', 'Contractor', 'Project Manager', 'Designer', 'Site Technical', 'Construction Supervisor'])],
'spatie_role' => ['nullable', 'string', Rule::in(['Super Admin', 'admin', 'Contractor', 'Contractor Admin', 'Project Manager', 'Designer', 'Site Technical', 'Construction Supervisor'])],
]);
// Resolve contractor_id: contractor admins always use their own;
@@ -123,12 +123,16 @@ class UserController extends Controller
// Determine Spatie role to assign
$roleToAssign = $validated['spatie_role'] ?? $validated['user_type'];
if ($roleToAssign === 'admin') {
$roleToAssign = 'Super Admin';
if ($roleToAssign === 'Contractor Admin') {
$roleToAssign = 'Contractor';
} elseif ($roleToAssign === 'admin') {
$roleToAssign = 'Main Contractor Admin';
}
// Explicitly assign the spatie role matching the user type or selected role
$user->assignRole($roleToAssign);
if ($roleToAssign) {
$user->assignRole($roleToAssign);
}
// Create profile
$this->createProfile($user, $validated);