/** * Run the Update * * @return mixed|void */ public function call() { $pheal = $this->setScope('corp')->setCorporationID()->getPheal(); $result = $pheal->MemberSecurityLog(); foreach ($result->roleHistory as $log_entry) { // Log entries are defined by a unique hash $hash = $this->hash_transaction($log_entry->characterID, $log_entry->changeTime, $log_entry->characterName, $log_entry->roleLocationType); // If we have the log entry, move to the next if (MemberSecurityLogModel::where('hash', $hash)->first()) { continue; } MemberSecurityLogModel::create(['hash' => $hash, 'corporationID' => $this->corporationID, 'characterID' => $log_entry->characterID, 'characterName' => $log_entry->characterName, 'changeTime' => $log_entry->changeTime, 'issuerID' => $log_entry->issuerID, 'issuerName' => $log_entry->issuerName, 'roleLocationType' => $log_entry->roleLocationType, 'oldRoles' => $this->json_roles($log_entry->oldRoles), 'newRoles' => $this->json_roles($log_entry->newRoles)]); } return; }
/** * Get the security change logs for a Corporation * * @param $corporation_id * * @return mixed */ public function getCorporationMemberSecurityLogs($corporation_id) { return MemberSecurityLog::where('corporationID', $corporation_id)->orderBy('changeTime', 'desc')->get(); }