Update ImportSebDataSeeder.php

This commit is contained in:
2026-03-25 09:53:04 +08:00
parent 72a48d84b9
commit 00a43e91ec

View File

@@ -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();