예제 #1
0
 /**
  * Return the skills detail for a specific Character
  *
  * @param $character_id
  *
  * @return mixed
  */
 public function getCharacterSkillsInformation($character_id)
 {
     return CharacterSheetSkills::join('invTypes', 'character_character_sheet_skills.typeID', '=', 'invTypes.typeID')->join('invGroups', 'invTypes.groupID', '=', 'invGroups.groupID')->where('character_character_sheet_skills.characterID', $character_id)->orderBy('invTypes.typeName')->get();
 }
예제 #2
0
파일: Search.php 프로젝트: eveseat/services
 /**
  * @return mixed
  */
 public function doSearchCharacterSkills()
 {
     // Get the user
     $user = auth()->user();
     // Start the skills query
     $skills = CharacterSheetSkills::join('invTypes', 'character_character_sheet_skills.typeID', '=', 'invTypes.typeID')->join('invGroups', 'invTypes.groupID', '=', 'invGroups.groupID')->join('account_api_key_info_characters', 'character_character_sheet_skills.characterID', '=', 'account_api_key_info_characters.characterID')->join('eve_api_keys', 'eve_api_keys.key_id', '=', 'account_api_key_info_characters.keyID');
     // If the user is not a superuser, filter the results.
     if (!$user->hasSuperUser()) {
         $skills = $skills->where(function ($query) use($user) {
             // If the user has any affiliations and can
             // list those characters, add them
             if ($user->has('character.skills', false)) {
                 $query = $query->whereIn('account_api_key_info_characters.characterID', array_keys($user->getAffiliationMap()['char']));
             }
             // Add any characters from owner API keys
             $query->orWhere('eve_api_keys.user_id', $user->id);
         });
     }
     return $skills;
 }