moon admin controller
This commit is contained in:
@@ -182,6 +182,8 @@ class MoonsAdminController extends Controller
|
||||
$contact = '';
|
||||
$paid = '';
|
||||
$rentalEnd = '';
|
||||
$renter = '';
|
||||
$ticker = '';
|
||||
|
||||
//Setup calls to the MoonCalc class
|
||||
$moonCalc = new MoonCalc();
|
||||
@@ -210,6 +212,11 @@ class MoonsAdminController extends Controller
|
||||
|
||||
//Set the contact info
|
||||
$contact = 'None';
|
||||
|
||||
//Set the renter info
|
||||
$renter = 'None';
|
||||
|
||||
$ticker = 'N/A';
|
||||
} else {
|
||||
//If we find a rental record, mark the moon as whether it's paid or not
|
||||
$paid = $rental->Paid;
|
||||
@@ -220,6 +227,11 @@ class MoonsAdminController extends Controller
|
||||
|
||||
//Set the contact name
|
||||
$contact = $lookup->CharacterName($rental->Contact);
|
||||
|
||||
//Set up the renter whether it's W4RP or another corporation
|
||||
$corpId = $lookup->LookupCorporationId($contact);
|
||||
$allianceId = $lookup->LookupCorporation($corpId);
|
||||
$ticker = $lookup->LookupAllianceTicker($allianceId);
|
||||
}
|
||||
|
||||
//Set the color for the table
|
||||
@@ -241,11 +253,12 @@ class MoonsAdminController extends Controller
|
||||
'StructureName' => $moon->StructureName,
|
||||
'AlliancePrice' => $price['alliance'],
|
||||
'OutOfAlliancePrice' => $price['outofalliance'],
|
||||
'Renter' => $moon->RentalCorp,
|
||||
'Renter' => $ticker,
|
||||
'RentalEnd' => $rentalEnd,
|
||||
'RowColor' => $color,
|
||||
'Paid' => $paid,
|
||||
'Contact' => $contact,
|
||||
'Renter' => $renter,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -213,6 +213,24 @@ class LookupHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public function LookupAllianceTicker($allianceId) {
|
||||
//Get the configuration for ESI from the environmental variable
|
||||
$config = config('esi');
|
||||
|
||||
//Setup a new ESI container
|
||||
$esi = new Eseye();
|
||||
|
||||
try {
|
||||
$alliance = $esi->invoke('get', '/alliances/{alliance_id}/', [
|
||||
'alliance_id' => $allianceId,
|
||||
]);
|
||||
} catch(\Seat\Eseye\Exceptions\RequestFailedException $e){
|
||||
return $e->getEsiResponse();
|
||||
}
|
||||
|
||||
return $alliance->ticker;
|
||||
}
|
||||
|
||||
//Update the character lookup table as often as necessary
|
||||
public function UpdateLookupCharacter() {
|
||||
//Create a new ESI container
|
||||
|
||||
Reference in New Issue
Block a user