private function updateIxInfo() { foreach ($this->ixs as $ix) { // Normilise the emails $emails = []; if (!empty($ix->tech_email)) { $emails[] = strtolower($ix->tech_email); } if (!empty($ix->policy_email)) { $emails[] = strtolower($ix->policy_email); } $emails = array_unique($emails); $ixEntry = IX::where('peeringdb_id', $ix->id)->first(); if (is_null($ixEntry) === true) { // As this entry does not exists we will create it. $this->cli->br()->comment('Adding IX: ' . $ix->name)->br(); $newIx = new IX(); $newIx->peeringdb_id = $ix->id; $newIx->name = $ix->name; $newIx->name_full = !empty($ix->name_long) ? $ix->name_long : $ix->name; $newIx->website = $ix->website; $newIx->tech_email = $ix->tech_email; $newIx->tech_phone = $ix->tech_phone; $newIx->policy_email = $ix->policy_email; $newIx->policy_phone = $ix->policy_phone; $newIx->city = $ix->city; $newIx->counrty_code = $ix->country; $newIx->url_stats = $ix->url_stats; $newIx->save(); continue; } $this->cli->br()->comment('Updating IX: ' . $ix->name)->br(); // Lets update the info that we have about the IX: $ixEntry->name = $ix->name; $ixEntry->name_full = !empty($ix->name_long) ? $ix->name_long : $ix->name; $ixEntry->website = $ix->website; $ixEntry->tech_email = $ix->tech_email; $ixEntry->tech_phone = $ix->tech_phone; $ixEntry->policy_email = $ix->policy_email; $ixEntry->policy_phone = $ix->policy_phone; $ixEntry->city = $ix->city; $ixEntry->counrty_code = $ix->country; $ixEntry->url_stats = $ix->url_stats; $ixEntry->save(); } }