converting all lookup functions to the new lookup helper

This commit is contained in:
2019-12-11 21:23:13 -06:00
parent 55225fdea3
commit 9e47568e67
14 changed files with 98 additions and 564 deletions

View File

@@ -8,7 +8,7 @@ use DB;
use Carbon\Carbon;
//Libraries
use App\Library\Lookups\LookupHelper;
use App\Library\Lookups\NewLookupHelper;
//use App\Library\Contracts\ContractHelper;
//Models
@@ -207,7 +207,7 @@ class ContractController extends Controller
]);
//Delcare some class variables we will need
$lookup = new LookupHelper;
$lookup = new NewLookupHelper;
$amount = 0.00;
@@ -231,8 +231,11 @@ class ContractController extends Controller
$characterId = auth()->user()->getId();
$characterName = auth()->user()->getName();
//Use the lookup helper in order to find the user's corporation id and name
$corporationId = $lookup->LookupCharacter($characterId);
$corporationName = $lookup->LookupCorporationName($corporationId);
$char = $looup->LookupCharacter($characterId, null);
$corporationId = $char->corporation_id;
//use the lookup helper in order to find the corporation's name from it's id.
$corp = $lookup->LookupCorporation($corporationId, null);
$corporationName = $corp->name;
//Before saving a bid let's check to see if the user already placed a bid on the contract
$found = Bid::where([

View File

@@ -20,7 +20,6 @@ use App\Models\MoonRent\MoonRental;
//Library
use App\Library\Moons\MoonCalc;
use App\Library\Esi\Esi;
use App\Library\Lookups\LookupHelper;
use App\Library\Lookups\NewLookupHelper;
class MoonsAdminController extends Controller
@@ -35,7 +34,6 @@ class MoonsAdminController extends Controller
public function displayMoonsAdmin() {
$this->middleware('role:Admin');
$lookup = new LookupHelper;
$lookupHelper = new NewLookupHelper;
$contact = '';
$paid = '';
@@ -97,7 +95,6 @@ class MoonsAdminController extends Controller
$rentalEnd = $rentalTemp->format('m-d');
//Set the contact name
//$contact = $lookup->CharacterName($rental->Contact);
$contact = $lookupHelper->CharacterIdToName($rental->Contact);
//Set up the renter whether it's W4RP or another corporation
@@ -216,7 +213,7 @@ class MoonsAdminController extends Controller
//Declare some static variables as needed
$moonCalc = new MoonCalc;
$lookup = new LookupHelper;
$lookup = new NewLookupHelper;
$paid = false;
$system = null;
$planet = null;
@@ -260,7 +257,9 @@ class MoonsAdminController extends Controller
}
//Let's find the corporation and alliance information to ascertain whethery they are in Warped Intentions or another Legacy Alliance
$allianceId = $lookup->LookupCorporation($lookup->LookupCharacter($contact));
$char = $lookup->LookupCharacter($contact, null);
$corp = $lookup->LookupCorporation($char->character_id, null);
$allianceId = $corp->alliance_id;
//Create the date
$date = new Carbon($request->date . '00:00:01');

View File

@@ -9,7 +9,7 @@ use DB;
use Auth;
//User Libraries
use App\Library\Lookups\LookupHelper;
use App\Library\Lookups\NewLookupHelper;
//Models
use App\Models\Doku\DokuGroupNames;
@@ -27,7 +27,7 @@ class WikiController extends Controller
public function purgeUsers() {
//Declare helper classes
$helper = new LookupHelper;
$lookup = new NewLookupHelper;
//Get all the users from the database
$users = DokuUser::pluck('name')->all();
@@ -42,10 +42,19 @@ class WikiController extends Controller
//If no name is found, then delete the user and have them start over with the wiki permissions
$count = User::where(['name' => $user])->count();
if($count > 0) {
//Get the user from the database
$charIdTemp = User::where(['name' => $user])->get(['character_id']);
//Set the character id
$charId = $charIdTemp[0]->character_id;
$corpId = $helper->LookupCharacter($charId);
$allianceId = $helper->LookupCorporation($corpId);
//Set the corp id
$char = $lookup->LookupCharacter($charId, null);
$corpId = $char->corporation_id;
//Set the alliance id
$corp = $lookup->LookupCorporation($corpId, null);
$allianceId = $corp->alliance_id;
if(in_array($allianceId, $legacy) || in_array($allianceId, $renter) || $allianceId == 99004116) {
//Do nothing