示例#1
0
 /**
  * Run the Update
  *
  * @return mixed|void
  */
 public function call()
 {
     $pheal = $this->setScope('corp')->setCorporationID()->getPheal();
     $result = $pheal->CorporationSheet();
     $corporation_sheet = CorporationSheetModel::firstOrNew(['corporationID' => $this->corporationID]);
     $corporation_sheet->fill(['corporationName' => $result->corporationName, 'ticker' => $result->ticker, 'ceoID' => $result->ceoID, 'ceoName' => $result->ceoName, 'stationID' => $result->stationID, 'stationName' => $result->stationName, 'description' => $result->description, 'url' => $result->url, 'allianceID' => $result->allianceID, 'factionID' => $result->factionID, 'allianceName' => $result->allianceName, 'memberCount' => $result->memberCount, 'memberLimit' => $result->memberLimit, 'shares' => $result->shares, 'graphicID' => $result->logo->graphicID, 'shape1' => $result->logo->shape1, 'shape2' => $result->logo->shape2, 'shape3' => $result->logo->shape3, 'color1' => $result->logo->color1, 'color2' => $result->logo->color2, 'color3' => $result->logo->color3]);
     $corporation_sheet->save();
     // Update the Divisional Information
     foreach ($result->divisions as $division) {
         $division_info = CorporationSheetDivision::firstOrNew(['corporationID' => $this->corporationID, 'accountKey' => $division->accountKey]);
         $division_info->fill(['description' => $division->description]);
         $division_info->save();
     }
     // Update Wallet Divisions Information
     foreach ($result->walletDivisions as $wallet_division) {
         $wallet_division_info = CorporationSheetWalletDivision::firstOrNew(['corporationID' => $this->corporationID, 'accountKey' => $wallet_division->accountKey]);
         $wallet_division_info->fill(['description' => $wallet_division->description]);
         $wallet_division_info->save();
     }
     return;
 }
 /**
  * Return the Corporation Divisions for a Corporation
  *
  * @param $corporation_id
  *
  * @return mixed
  */
 public function getCorporationDivisions($corporation_id)
 {
     return CorporationSheetDivision::where('corporationID', $corporation_id)->get();
 }