first(); $data = [ 'agent_id' => $id, 'company_name' => 'Kartsandy', // Case insensitive lookup will handle 'kartsandy' 'employee_id' => 'gurubesar', // [NEW] User preference // 'username' => 'gurunesar', // Deprecated preference 'email' => 'andy@gmail.com', 'phone' => '08123456789', 'address' => 'Jakarta Headquarters', 'subscription_duration' => 9999, // Forever 'is_active' => true, 'role' => 'master', 'ip_whitelist' => [], 'api_secret_key' => 'sk_live_' . $id, // sk_live_AGT-MASTER matches frontend default 'password' => Hash::make('abcd1234'), ]; if ($agent) { $agent->update($data); $this->command->info("Updated Agent: {$id}"); } else { Agent::create($data); $this->command->info("Created Agent: {$id}"); } } }