Exemple #1
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;
 }
Exemple #2
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $possible_corp_starbases = Starbase::where('corporationID', $this->route('corporation_id'))->lists('itemID')->implode(',');
     return ['starbase_id' => 'required|numeric|in:' . $possible_corp_starbases];
 }