'admin@company.com'], [ 'name' => 'System Administrator', 'password' => Hash::make('Admin@123'), 'role' => 'admin', ] ); // 2. Seed default roles (Preserve description if modified) $pmRole = Role::firstOrCreate( ['name' => 'Project Manager'], ['description' => 'Oversees projects, budgets, and milestones.'] ); $leadRole = Role::firstOrCreate( ['name' => 'Team Lead'], ['description' => 'Manages dev teams and assigns work items.'] ); $salesRole = Role::firstOrCreate( ['name' => 'Sales Team'], ['description' => 'Drives client acquisition and manages CRM leads.'] ); $devRole = Role::firstOrCreate( ['name' => 'Developer'], ['description' => 'Writes code and builds features.'] ); $internRole = Role::firstOrCreate( ['name' => 'Intern'], ['description' => 'Learning and assisting on project modules.'] ); $hrRole = Role::firstOrCreate( ['name' => 'HR Manager'], ['description' => 'Handles recruitment, payroll, and employee relations.'] ); // 3. Seed default apps/services (Preserve if already exists) $outlookCalendar = App::firstOrCreate( ['name' => 'Outlook Calendar'], [ 'url' => 'https://outlook.cloud.microsoft/calendar/view/workweek?deeplink=mail%2F', 'icon_svg' => 'outlook', 'color' => '#0078d4', 'desc' => 'Access your workweek calendar and scheduled meetings.', 'tag' => 'Microsoft 365' ] ); $convexCrm = App::firstOrCreate( ['name' => 'Convex CRM'], [ 'url' => 'https://convexsol.convexcrm.com/', 'icon_svg' => 'keka', 'color' => '#4f46e5', 'desc' => 'Customer Relationship Management and lead tracking portal.', 'tag' => 'CRM' ] ); $copilot = App::firstOrCreate( ['name' => 'Microsoft Copilot'], [ 'url' => 'https://outlook.cloud.microsoft/host/b5abf2ae-c16b-4310-8f8a-d3bcdb52f162/entity1-d870f6cd-4aa5-4d42-9626-ab690c041429', 'icon_svg' => 'teams', 'color' => '#0078d4', 'desc' => 'AI-powered productivity and search assistant.', 'tag' => 'AI Assistant' ] ); $demoCrm = App::firstOrCreate( ['name' => 'Convex Demo CRM'], [ 'url' => 'https://demo-convexcrm.convexsol.co/', 'icon_svg' => 'keka', 'color' => '#06b6d4', 'desc' => 'Demonstration environment for Convex CRM features.', 'tag' => 'CRM' ] ); $git = App::firstOrCreate( ['name' => 'SentientGeeks Git'], [ 'url' => 'https://git.sentientgeeks.us/', 'icon_svg' => 'outlook', 'color' => '#f1502f', 'desc' => 'Self-hosted repository hosting and code collaboration tool.', 'tag' => 'Dev Tools' ] ); $internalCrm = App::firstOrCreate( ['name' => 'Internal CRM'], [ 'url' => 'https://internal.convexcrm.com/', 'icon_svg' => 'keka', 'color' => '#10b981', 'desc' => 'Internal client relations and account directory panel.', 'tag' => 'CRM' ] ); $keka = App::firstOrCreate( ['name' => 'Keka HR'], [ 'url' => 'https://sentientgeeks.keka.com/', 'icon_svg' => 'keka', 'color' => '#f27059', 'desc' => 'Manage timesheets, leaves, payroll, and performance tasks.', 'tag' => 'HR Portal' ] ); $teams = App::firstOrCreate( ['name' => 'Microsoft Teams'], [ 'url' => 'https://teams.microsoft.com/v2/', 'icon_svg' => 'teams', 'color' => '#6264a7', 'desc' => 'Chat, meet, call, and collaborate with your team.', 'tag' => 'Microsoft 365' ] ); $outlookMail = App::firstOrCreate( ['name' => 'Outlook Mail'], [ 'url' => 'https://outlook.cloud.microsoft/host/377c982d-9686-450e-9a7c-22aeaf1bc162/7211f19f-262a-42eb-a02e-289956491741', 'icon_svg' => 'outlook', 'color' => '#0078d4', 'desc' => 'Corporate email and messaging inbox.', 'tag' => 'Microsoft 365' ] ); $outlookMailSecondary = App::firstOrCreate( ['name' => 'Outlook Mail (Secondary)'], [ 'url' => 'https://outlook.cloud.microsoft/host/1f8c20f5-d70f-4f8e-93e1-31d8fce0c8c9/096f3341-6ebc-45ac-b97f-e28aecd40b66', 'icon_svg' => 'outlook', 'color' => '#0369a1', 'desc' => 'Secondary business communications gateway.', 'tag' => 'Microsoft 365' ] ); $todo = App::firstOrCreate( ['name' => 'Microsoft To-Do'], [ 'url' => 'https://outlook.cloud.microsoft/host/0d5c91ee-5be2-4b79-81ed-23e6c4580427/ToDoId', 'icon_svg' => 'outlook', 'color' => '#2563eb', 'desc' => 'Organize, track, and complete daily lists and tasks.', 'tag' => 'Microsoft 365' ] ); // 4. Assign default apps/services to specific roles ONLY IF role was recently created if ($hrRole->wasRecentlyCreated) { $hrRole->apps()->sync([$outlookMail->id, $outlookCalendar->id, $teams->id, $keka->id, $todo->id]); } if ($devRole->wasRecentlyCreated) { $devRole->apps()->sync([$outlookMail->id, $outlookCalendar->id, $teams->id, $git->id, $todo->id]); } if ($leadRole->wasRecentlyCreated) { $leadRole->apps()->sync([$outlookMail->id, $outlookCalendar->id, $teams->id, $git->id, $todo->id]); } if ($pmRole->wasRecentlyCreated) { $pmRole->apps()->sync([$outlookMail->id, $outlookCalendar->id, $teams->id, $todo->id]); } if ($salesRole->wasRecentlyCreated) { $salesRole->apps()->sync([$teams->id, $convexCrm->id, $demoCrm->id]); } if ($internRole->wasRecentlyCreated) { $internRole->apps()->sync([$teams->id]); } // 5. Seed default standard users and assign roles (Preserve if already exists) $user1 = User::firstOrCreate( ['email' => 'user@company.com'], [ 'name' => 'John Doe User', 'role' => 'user', 'microsoft_id' => 'mock-microsoft-id-123', ] ); if ($user1->wasRecentlyCreated) { $user1->roles()->sync([$devRole->id, $leadRole->id]); } $user2 = User::firstOrCreate( ['email' => 'hr@company.com'], [ 'name' => 'Jane Smith HR', 'role' => 'user', 'microsoft_id' => 'mock-microsoft-id-456', ] ); if ($user2->wasRecentlyCreated) { $user2->roles()->sync([$hrRole->id]); } // 6. Seed user-specific overrides ONLY IF override is recently created if ($user1->wasRecentlyCreated) { UserAppOverride::firstOrCreate( ['user_id' => $user1->id, 'app_id' => $outlookMail->id], ['type' => 'deny'] ); UserAppOverride::firstOrCreate( ['user_id' => $user1->id, 'app_id' => $keka->id], ['type' => 'allow'] ); } // Seed default role setting Setting::firstOrCreate( ['key' => 'default_role'], ['value' => 'Developer'] ); } }