Пример #1
0
 /**
  * Gets a user's main character sheet.
  *
  * @param  \Seat\Web\Models\User $user
  * @param  string                $service
  *
  * @return \Seat\Eveapi\Models\Character\CharacterSheet
  */
 private function getMainCharacter(User $user, $service)
 {
     // Get the character id from the user's settings.
     $characterID = $user->settings->where('name', 'main_character_id')->first();
     $characterID = $characterID ? $characterID->value : false;
     // Get the character sheet of the main character if the character exists in $characters.
     $characters = $this->getValidCharacters($user, $service);
     $character = $characters->whereLoose('characterID', $characterID)->first();
     $character = $character ? $this->character_sheets->where('characterID', $character->characterID)->first() : false;
     return $character;
 }
Пример #2
0
 /**
  * @param $character_id
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function getCharacterSkillsCoverageChartData($character_id)
 {
     if ($character_id == 1) {
         return response()->json([]);
     }
     $data = $this->getCharacterSkillCoverage($character_id);
     $character = CharacterSheet::where('characterID', $character_id)->first();
     return response()->json(['labels' => $data->map(function ($item) {
         return $item->marketGroupName;
     })->toArray(), 'datasets' => [['label' => $character->name, 'data' => $data->map(function ($item) {
         return round($item->characterAmount / $item->gameAmount * 100, 2);
         // character / in game rate
     })->toArray(), 'fill' => true, 'backgroundColor' => 'rgba(60,141,188,0.3)', 'borderColor' => '#3c8dbc', 'pointBackgroundColor' => '#3c8dbc', 'pointBorderColor' => '#fff']]]);
 }