store operations form
This commit is contained in:
@@ -88,10 +88,11 @@ class MiningTaxesAdminController extends Controller
|
||||
'structure' => 'required',
|
||||
]);
|
||||
|
||||
//Get the name of the structure from the table
|
||||
$m = Observer::where([
|
||||
'observer_id' => $request->structure,
|
||||
])->first();
|
||||
$config = config('esi');
|
||||
$sHelper = new StructureHelper($config['primary'], $config['corporation']);
|
||||
|
||||
//Get the name of the structure from the database
|
||||
$m = $sHelper->GetStructureInfo($request->structure);
|
||||
|
||||
//Save the mining operation into the database
|
||||
$operation = new MiningOperation;
|
||||
|
||||
@@ -95,7 +95,17 @@ class StructureHelper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for a structure in our own database, otherwise pull it from esi.
|
||||
*/
|
||||
public function GetStructureInfo($structureId) {
|
||||
$info = Struture::where([
|
||||
'structure_id' => $structureId,
|
||||
])->first();
|
||||
|
||||
if($info != null) {
|
||||
return $info;
|
||||
} else {
|
||||
try {
|
||||
$info = $this->esi->invoke('get', '/universe/structures/{structure_id}/', [
|
||||
'structure_id' => $structureId,
|
||||
@@ -105,11 +115,12 @@ class StructureHelper {
|
||||
Log::warning($e->getCode());
|
||||
Log::warning($e->getMessage());
|
||||
Log::warning($e->getEsiResponse());
|
||||
$info = null;
|
||||
return null;
|
||||
}
|
||||
|
||||
return $info;
|
||||
}
|
||||
}
|
||||
|
||||
private function UpdateExistingStructure($structure, $info) {
|
||||
$esi = new Esi;
|
||||
|
||||
Reference in New Issue
Block a user