Esempio n. 1
0
 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle()
 {
     $api = new Api();
     $member = $this->member;
     $data = $api->getProfileInfo($member->battletag);
     /* Update member paragon levels */
     $member->paragon = $data['paragonLevel'];
     $member->paragon_hc = $data['paragonLevelHardcore'];
     $member->paragon_curr_season = $data['paragonLevelSeason'];
     $member->paragon_curr_season_hc = $data['paragonLevelSeasonHardcore'];
     $member->save();
     /* Update members characters */
     $characters = $data['heroes'];
     $charClass = new CharacterClass();
     foreach ($characters as $char) {
         $char['class'] = $charClass->getClassId($char['class']);
         $char['owner_id'] = $member->id;
         $char_id = Character::CreateOrUpdate($char);
         /* Also create a stats entry so that we can use eager loading (join) - without losing characters */
         $data = ['character_id' => $char_id];
         CharacterStats::CreateOrUpdate($data);
     }
 }