/** * Execute the command. * * @return void */ public function handle() { $api = new Api(); $char = $this->character; $member = $this->member; $data = $api->getCharacterInfo($member->battletag, $char->diablo_id); /* Unset keys that aren't required for easier debugging */ unset($data['skills']); unset($data['items']); unset($data['followers']); unset($data['progression']); $this->updateStats($data); }
/** * 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); } }