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