Пример #1
0
 /**
  * Run the Update
  *
  * @return mixed|void
  */
 public function call()
 {
     $pheal = $this->setScope('corp')->setCorporationID()->getPheal();
     $starbase_ids = DB::table('corporation_starbases')->where('corporationID', $this->corporationID)->pluck('itemID');
     foreach ($starbase_ids as $starbase_id) {
         $result = $pheal->StarbaseDetail(['itemID' => $starbase_id]);
         $detail_info = StarbaseDetailModel::firstOrNew(['corporationID' => $this->corporationID, 'itemID' => $starbase_id]);
         $detail_info->fill(['state' => $result->state, 'stateTimestamp' => $result->stateTimestamp, 'onlineTimestamp' => $result->onlineTimestamp, 'usageFlags' => $result->generalSettings->usageFlags, 'deployFlags' => $result->generalSettings->deployFlags, 'allowCorporationMembers' => $result->generalSettings->allowCorporationMembers, 'allowAllianceMembers' => $result->generalSettings->allowAllianceMembers, 'useStandingsFrom' => $result->combatSettings->useStandingsFrom->ownerID, 'onStandingDrop' => $result->combatSettings->onStandingDrop->standing, 'onStatusDropEnabled' => $result->combatSettings->onStatusDrop->enabled, 'onStatusDropStanding' => $result->combatSettings->onStatusDrop->standing, 'onAggression' => $result->combatSettings->onAggression->enabled, 'onCorporationWar' => $result->combatSettings->onCorporationWar->enabled, 'fuelBlocks' => $this->get_fuel('fuelBlocks', $result->fuel), 'strontium' => $this->get_fuel('strontium', $result->fuel), 'starbaseCharter' => $this->get_fuel('starbaseCharter', $result->fuel)]);
         $detail_info->save();
     }
     return;
 }
Пример #2
0
 /**
  * Run the Update
  *
  * @return mixed|void
  */
 public function call()
 {
     $pheal = $this->setScope('corp')->setCorporationID()->getPheal();
     $result = $pheal->StarbaseList();
     foreach ($result->starbases as $starbase) {
         $starbase_info = Starbase::firstOrNew(['corporationID' => $this->corporationID, 'itemID' => $starbase->itemID]);
         $starbase_info->fill(['typeID' => $starbase->typeID, 'locationID' => $starbase->locationID, 'moonID' => $starbase->moonID, 'state' => $starbase->state, 'stateTimestamp' => $starbase->stateTimestamp, 'onlineTimestamp' => $starbase->onlineTimestamp, 'standingOwnerID' => $starbase->standingOwnerID]);
         $starbase_info->save();
     }
     // Cleanup old Starbases
     Starbase::where('corporationID', $this->corporationID)->whereNotIn('itemID', array_map(function ($starbase) {
         return $starbase->itemID;
     }, (array) $result->starbases))->delete();
     // Cleanup old Starbase details.
     StarbaseDetailModel::where('corporationID', $this->corporationID)->whereNotIn('itemID', array_map(function ($starbase) {
         return $starbase->itemID;
     }, (array) $result->starbases))->delete();
     return;
 }