コード例 #1
0
 /**
  * Run the Update
  *
  * @return mixed|void
  */
 public function call()
 {
     $pheal = $this->setScope('corp')->setCorporationID()->getPheal();
     // Looking at the CustomsOffice update, we see that
     // the table is cleaned up beforehand as the
     // itemID's may change for assets. For this call
     // to the Locations endpoint, we will also have
     // to cleanup as we will be referencing the same
     // itemID's
     CustomsOfficeLocation::where('corporationID', $this->corporationID)->delete();
     // We get an array of items ID's that is keyed
     // by the itemID's so that we can later use this
     // same array to lookup the locationID for the
     // nearest_celestial lookup.
     $item_ids = CustomsOfficeModel::where('corporationID', $this->corporationID)->get()->keyBy('itemID')->toArray();
     // Chunk the requests to the API as the ids field
     // could get too long with all of the bigInts inside
     // of the query string.
     foreach (array_chunk($item_ids, 100) as $items) {
         // Apply array_column so that we only pass the
         // itemID's in the query string to the API
         $result = $pheal->Locations(['ids' => implode(',', array_column($items, 'itemID'))]);
         foreach ($result->locations as $location) {
             $nearest_celestial = $this->find_nearest_celestial($item_ids[$location->itemID]['locationID'], $location->x, $location->y, $location->z);
             CustomsOfficeLocation::create(['corporationID' => $this->corporationID, 'itemID' => $location->itemID, 'itemName' => $location->itemName, 'x' => $location->x, 'y' => $location->y, 'z' => $location->z, 'mapID' => $nearest_celestial['mapID'], 'mapName' => $nearest_celestial['mapName']]);
         }
         // Foreach Location
     }
     return;
 }
コード例 #2
0
ファイル: CustomsOffices.php プロジェクト: eveseat/eveapi
 /**
  * Run the Update
  *
  * @return mixed|void
  */
 public function call()
 {
     $pheal = $this->setScope('corp')->setCorporationID()->getPheal();
     $result = $pheal->CustomsOffices();
     // Items can apparently change ID's, so we need to
     // delete everything we have for now.
     CustomsOfficeModel::where('corporationID', $this->corporationID)->delete();
     foreach ($result->pocos as $poco) {
         CustomsOfficeModel::create(['corporationID' => $this->corporationID, 'itemID' => $poco->itemID, 'solarSystemID' => $poco->solarSystemID, 'solarSystemName' => $poco->solarSystemName, 'reinforceHour' => $poco->reinforceHour, 'allowAlliance' => $poco->allowAlliance, 'allowStandings' => $poco->allowStandings, 'standingLevel' => $poco->standingLevel, 'taxRateAlliance' => $poco->taxRateAlliance, 'taxRateCorp' => $poco->taxRateCorp, 'taxRateStandingHigh' => $poco->taxRateStandingHigh, 'taxRateStandingGood' => $poco->taxRateStandingGood, 'taxRateStandingNeutral' => $poco->taxRateStandingNeutral, 'taxRateStandingBad' => $poco->taxRateStandingBad, 'taxRateStandingHorrible' => $poco->taxRateStandingHorrible]);
     }
     return;
 }
コード例 #3
0
 /**
  * Return a Corporations Customs Offices
  *
  * @param $corporation_id
  *
  * @return mixed
  */
 public function getCorporationCustomsOffices($corporation_id)
 {
     return CustomsOffice::select('corporation_customs_offices.*', 'corporation_customs_office_locations.itemName as planetName', 'mapDenormalize.typeID AS planetTypeID', 'invTypes.typeName AS planetTypeName')->join('corporation_customs_office_locations', 'corporation_customs_offices.itemID', '=', 'corporation_customs_office_locations.itemID')->join('mapDenormalize', 'corporation_customs_office_locations.mapID', '=', 'mapDenormalize.itemID')->join('invTypes', 'invTypes.typeID', '=', 'mapDenormalize.typeID')->where('corporation_customs_offices.corporationID', $corporation_id)->get();
 }