diff --git a/database/seeders/ImportSebDataSeeder.php b/database/seeders/ImportSebDataSeeder.php index 9fb774d..cd1c5bd 100644 --- a/database/seeders/ImportSebDataSeeder.php +++ b/database/seeders/ImportSebDataSeeder.php @@ -9,8 +9,8 @@ use App\Models\User; class ImportSebDataSeeder extends Seeder { - // The company user ID for SEB Connexion tenant - private int $companyId = 66; + // The company user ID for SEB Connexion tenant (resolved dynamically) + private int $companyId; // ID mapping arrays (old → new) private array $userMap = []; @@ -23,6 +23,16 @@ class ImportSebDataSeeder extends Seeder public function run(): void { + // Dynamically resolve the company owner ID + $marlon = User::where('email', 'marlon.domagtoy@sebconnexion.com')->first(); + if (!$marlon) { + $this->command->error('❌ Company user marlon.domagtoy@sebconnexion.com not found. Please register this account first.'); + return; + } + $this->companyId = $marlon->id; + $this->userMap[1] = $marlon->id; // Map old user 1 (Marlon) to actual ID + $this->command->info("Using company ID: {$this->companyId} (Marlon Domagtoy)"); + DB::transaction(function () { $this->createAdminUser(); $this->importDepartments();