From ed7035f03038a1c0143df1ecc3088a3b47c81143 Mon Sep 17 00:00:00 2001 From: drkthunder02 Date: Mon, 29 Apr 2019 03:10:04 -0500 Subject: [PATCH] moon rental update for admin --- app/Http/Controllers/MoonsAdminController.php | 6 +++++- app/Library/Lookups/LookupHelper.php | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/MoonsAdminController.php b/app/Http/Controllers/MoonsAdminController.php index 64d078f07..9841a8c7f 100644 --- a/app/Http/Controllers/MoonsAdminController.php +++ b/app/Http/Controllers/MoonsAdminController.php @@ -175,6 +175,9 @@ class MoonsAdminController extends Controller * Function to display the moons to admins */ public function displayMoonsAdmin() { + $lookup = new LookupHelper; + $contact = ''; + //Setup calls to the MoonCalc class $moonCalc = new MoonCalc(); //Update the prices for the moon @@ -211,7 +214,8 @@ class MoonsAdminController extends Controller if(!isset($contact->Contact)) { $contact = 'None'; } else { - $contact = $contact->Contact; + //Get the name of the character + $contact = $lookup->CharacterName($contact->Contact); } //Set the color for the table diff --git a/app/Library/Lookups/LookupHelper.php b/app/Library/Lookups/LookupHelper.php index 9ff854da8..89644d6e4 100644 --- a/app/Library/Lookups/LookupHelper.php +++ b/app/Library/Lookups/LookupHelper.php @@ -15,6 +15,19 @@ use App\Models\Lookups\CorporationToAlliance; class LookupHelper { + public function CharacterName($charId) { + $name = ''; + $temp = CharacterToCorporation::where(['character_id' => $charId])->get(['character_name']); + + if(!isset($temp->character_name)) { + $name = 'None'; + } else { + $name = $temp->character_name; + } + + return $name; + } + //Create a character id from a character name public function CharacterNameToId($character) { //Setup Eseye Configuration