updated lookup helpers

This commit is contained in:
2019-06-28 20:09:48 -05:00
parent b0da66f2e8
commit 691a930893

View File

@@ -40,16 +40,20 @@ class LookupHelper {
//Attempt to find the character name in the LookupCharacter table to see if we can match it to an id //Attempt to find the character name in the LookupCharacter table to see if we can match it to an id
$count = CharacterToCorporation::where(['character_name' => $character])->count(); $count = CharacterToCorporation::where(['character_name' => $character])->count();
if($count == 0) { if($count == 0) {
//Get the character id from the ESI API. try {
$response = $esi->setQueryString([ //Get the character id from the ESI API.
'categories' => 'character', $response = $esi->setQueryString([
'search' => $character, 'categories' => 'character',
'strict' => 'true', 'search' => $character,
])->invoke('get', '/search/'); 'strict' => 'true',
])->invoke('get', '/search/');
} catch(RequestFailedException $e) {
$this->LookupCharacter($response->character[0]); }
return $response->character[0]; $this->LookupCharacter($response['character'][0]);
return $response['character'][0];
} else { } else {
$char = CharacterToCorporation::where(['character_name' => $character])->get(['character_id']); $char = CharacterToCorporation::where(['character_name' => $character])->get(['character_id']);