updated lookup helpers
This commit is contained in:
@@ -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']);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user