call(RoleSeeder::class); // 1. Super Admin $admin = User::firstOrCreate( ['email' => 'admin@crewli.test'], [ 'name' => 'Dev Admin', 'password' => Hash::make('password'), ], ); $admin->assignRole('super_admin'); // Test organisation $org = Organisation::firstOrCreate( ['slug' => 'test-festival-bv'], [ 'name' => 'Test Festival BV', 'billing_status' => 'active', 'settings' => [], ], ); // 2. Org Admin $orgAdmin = User::firstOrCreate( ['email' => 'orgadmin@crewli.test'], [ 'name' => 'Org Admin', 'password' => Hash::make('password'), ], ); if (!$org->users()->where('user_id', $orgAdmin->id)->exists()) { $org->users()->attach($orgAdmin, ['role' => 'org_admin']); } // Second test organisation (for testing the organisation switcher) $org2 = Organisation::firstOrCreate( ['slug' => 'zomerfest-nederland'], [ 'name' => 'Zomerfest Nederland', 'billing_status' => 'trial', 'settings' => [], ], ); // Attach admin and orgAdmin to second org too if (!$org2->users()->where('user_id', $admin->id)->exists()) { $org2->users()->attach($admin, ['role' => 'org_admin']); } if (!$org2->users()->where('user_id', $orgAdmin->id)->exists()) { $org2->users()->attach($orgAdmin, ['role' => 'org_member']); } // 3. Org Member $member = User::firstOrCreate( ['email' => 'crew@crewli.test'], [ 'name' => 'Crew Member', 'password' => Hash::make('password'), ], ); if (!$org->users()->where('user_id', $member->id)->exists()) { $org->users()->attach($member, ['role' => 'org_member']); } } }