diff --git a/app/Http/Controllers/Wiki/WikiController.php b/app/Http/Controllers/Wiki/WikiController.php index ad8430370..57dc9d2a3 100644 --- a/app/Http/Controllers/Wiki/WikiController.php +++ b/app/Http/Controllers/Wiki/WikiController.php @@ -16,6 +16,7 @@ use App\Models\Doku\DokuGroupNames; use App\Models\Doku\DokuMember; use App\Models\Doku\DokuUser; use App\Models\Admin\AllowedLogin; +use App\Models\User\User; class WikiController extends Controller { @@ -37,7 +38,12 @@ class WikiController extends Controller //Search the names and verify against the lookup table //to find the corporation and / or alliance they belong to. foreach($users as $user) { - $charId = $helper->CharacterNameToId($user); + //Let's look up the character in the user table by their name. + //If no name is found, then delete the user and have them start over with the wiki permissions + $charIdTemp = User::where(['name' => $user])->get(['character_id']); + $charId = $charIdTemp[0]->character_id; + dd($charId); + $corpId = $helper->LookupCharacter($charId); $allianceId = $helper->LookupCorporation($corpId); if(in_array($allianceId, $legacy) || in_array($allianceId, $renter) || $allianceId == 99004116) { diff --git a/app/Library/Lookups/LookupHelper.php b/app/Library/Lookups/LookupHelper.php index e46747daf..b55d279a9 100644 --- a/app/Library/Lookups/LookupHelper.php +++ b/app/Library/Lookups/LookupHelper.php @@ -47,18 +47,16 @@ class LookupHelper { 'search' => $name, 'strict' => 'false', ])->invoke('get', '/search/'); - - } catch(RequestFailedException $e) { } - dd($response); - - if(isset($response->character)) { - $this->LookupCharacter($response->character); + if(isset($response->character[0])) { + $this->LookupCharacter($response->character[0]); return $response->character; + } else { + return -1; } } else { @@ -66,8 +64,6 @@ class LookupHelper { return $char[0]->character_id; } - - //return 0; } //Add characters to the lookup table for quicker lookups without having