diff --git a/app/Console/Commands/Assets/GetAssets.php b/app/Console/Commands/Assets/GetAssets.php index 811260ffd..14eecfa42 100644 --- a/app/Console/Commands/Assets/GetAssets.php +++ b/app/Console/Commands/Assets/GetAssets.php @@ -13,6 +13,7 @@ use App\Jobs\ProcessAssetsJob; use App\Library\Esi\Esi; use Commands\Library\CommandHelper; use App\Library\Assets\AssetHelper; +use Seat\Eseye\Exceptions\RequestFailedException; //Models use App\Models\Jobs\JobProcessAsset; diff --git a/app/Console/Commands/Corps/GetCorps.php b/app/Console/Commands/Corps/GetCorps.php index 87d188e54..95abcacd7 100644 --- a/app/Console/Commands/Corps/GetCorps.php +++ b/app/Console/Commands/Corps/GetCorps.php @@ -2,17 +2,18 @@ namespace App\Console\Commands; +//Internal Library use Illuminate\Console\Command; use DB; use Commands\Library\CommandHelper; +//Models use App\Models\Corporation\AllianceCorp; use App\Models\ScheduledTask\ScheduleJob; -use Seat\Eseye\Cache\NullCache; -use Seat\Eseye\Configuration; -use Seat\Eseye\Containers\EsiAuthentication; -use Seat\Eseye\Eseye; +//Library +use Seat\Eseye\Exceptions\RequestFailedException; +use App\Library\Esi\Esi; class GetCorpsCommand extends Command { @@ -51,15 +52,18 @@ class GetCorpsCommand extends Command $task = new CommandHelper('CorpJournal'); //Add the entry into the jobs table saying the job is starting $task->SetStartStatus(); + + //Declare some variables + $esiHelper = new Esi; - //Create the ESI container - $esi = new Eseye(); + $esi = $esiHelper->SetupEsiAuthentication(); + //try the esi call to get all of the corporations in the alliance try { $corporations = $esi->invoke('get', '/alliances/{alliance_id}/corporations/', [ 'alliance_id' => 99004116, ]); - } catch(\Seat\Eseye\Exceptions\RequestFailedException $e){ + } catch(RequestFailedException $e){ dd($e->getEsiResponse()); } //Delete all of the entries in the AllianceCorps table @@ -69,7 +73,7 @@ class GetCorpsCommand extends Command $corpInfo = $esi->invoke('get', '/corporations/{corporation_id}/', [ 'corporation_id' => $corp, ]); - } catch(\Seat\Eseye\Exceptions\RequestFailedException $e) { + } catch(RequestFailedException $e) { return $e->getEsiResponse(); } $entry = new AllianceCorp; diff --git a/app/Console/Commands/Structures/GetStructures.php b/app/Console/Commands/Structures/GetStructures.php index 3cdafcbed..065f8e6c4 100644 --- a/app/Console/Commands/Structures/GetStructures.php +++ b/app/Console/Commands/Structures/GetStructures.php @@ -9,6 +9,7 @@ use Log; use App\Library\Structures\StructureHelper; use App\Library\Esi\Esi; use Commands\Library\CommandHelper; +use Seat\Eseye\Exceptions\RequestFailedException; //Job use App\Jobs\ProcessStructureJob; @@ -82,7 +83,7 @@ class GetStructuresCommand extends Command } //Get the refresh token from the database - $token = EsiToken::where(['character_id' => $charId])->get(['refresh_token']); + $token = $esiHelper->GetRefreshToken($charId); //Create the esi authentication container $esi = $esiHelper->SetupEsiAuthentication($token); diff --git a/app/Console/Commands/Users/PurgeUsers.php b/app/Console/Commands/Users/PurgeUsers.php index b5931bfc3..88be354cf 100644 --- a/app/Console/Commands/Users/PurgeUsers.php +++ b/app/Console/Commands/Users/PurgeUsers.php @@ -7,10 +7,8 @@ use Illuminate\Console\Command; use Log; //Libraries -use Seat\Eseye\Cache\NullCache; -use Seat\Eseye\Configuration; -use Seat\Eseye\Containers\EsiAuthentication; -use Seat\Eseye\Eseye; +use Seat\Eseye\Exceptions\RequestFailedException; +use App\Library\Esi\Esi; //Models use App\Models\User\User; @@ -60,8 +58,11 @@ class PurgeUsers extends Command */ public function handle() { + //Declare some variables + $esiHelper = new Esi; + //Setup the esi variable - $esi = new Eseye(); + $esi = $esiHelper->SetupEsiAuthentication(); //Get all of the users from the database $users = User::all(); diff --git a/app/Http/Controllers/Market/MarketController.php b/app/Http/Controllers/Market/MarketController.php index ef828f767..b2646981a 100644 --- a/app/Http/Controllers/Market/MarketController.php +++ b/app/Http/Controllers/Market/MarketController.php @@ -10,10 +10,6 @@ use Carbon\Carbon; //Library use App\Library\Esi\Esi; -use Seat\Eseye\Cache\NullCache; -use Seat\Eseye\Configuration; -use Seat\Eseye\Containers\EsiAuthentication; -use Seat\Eseye\Eseye; use Seat\Eseye\Exceptions\RequestFailedException; use App\Library\Taxes\TaxesHelper; @@ -45,7 +41,7 @@ class MarketController extends Controller //Declare the esi helper $esiHelper = new Esi; //Create the esi container to get the character's public information - $esi = new Eseye(); + $esi = $esiHelper->SetupEsiAuthentication(); try { $charInfo = $esi->invoke('get', '/characters/{character_id}/', [ 'character_id' => $charId, @@ -67,9 +63,13 @@ class MarketController extends Controller } public function displayTaxes() { + //Declare some variables + $esiHelper = new Esi; $charId = auth()->user()->getId(); - $esi = new Eseye(); + //Setup the esi authentication container + $esi = $esiHelper->SetupEsiAuthentication(); + try { $charInfo = $esi->invoke('get', '/characters/{character_id}/', [ 'character_id' => $charId, diff --git a/app/Http/Controllers/Moons/MoonLedgerController.php b/app/Http/Controllers/Moons/MoonLedgerController.php index d26fe2d80..bb614dfa0 100644 --- a/app/Http/Controllers/Moons/MoonLedgerController.php +++ b/app/Http/Controllers/Moons/MoonLedgerController.php @@ -9,10 +9,6 @@ use Log; use DB; //App Library -use Seat\Eseye\Cache\NullCache; -use Seat\Eseye\Configuration; -use Seat\Eseye\Containers\EsiAuthentication; -use Seat\Eseye\Eseye; use Seat\Eseye\Exceptions\RequestFailedException; use App\Library\Esi\Esi; use App\Library\Structures\StructureHelper; diff --git a/app/Library/Contracts/EveContractsHelper.php b/app/Library/Contracts/EveContractsHelper.php index 078b74485..4b489a55d 100644 --- a/app/Library/Contracts/EveContractsHelper.php +++ b/app/Library/Contracts/EveContractsHelper.php @@ -9,6 +9,7 @@ use DB; //App Library use App\Jobs\Library\JobHelper; use App\Library\Esi\Esi; +use Seat\Eseye\Exceptions\RequestFailedException; //Models use App\Models\Jobs\JobProcessContracts; diff --git a/app/Library/Finances/Helper/FinanceHelper.php b/app/Library/Finances/Helper/FinanceHelper.php index eb4b53f04..e565b554c 100644 --- a/app/Library/Finances/Helper/FinanceHelper.php +++ b/app/Library/Finances/Helper/FinanceHelper.php @@ -34,8 +34,6 @@ use App\Library\Finances\PISale; use App\Library\Lookups\NewLookupHelper; //Seat Stuff -use Seat\Eseye\Containers\EsiAuthentication; -use Seat\Eseye\Eseye; use Seat\Eseye\Exceptions\RequestFailedException; @@ -87,7 +85,6 @@ class FinanceHelper { 'division' => $division, ]); } catch(RequestFailedException $e) { - //Log::warning($e->getEsiResponse()); return null; } diff --git a/app/Library/Lookups/NewLookupHelper.php b/app/Library/Lookups/NewLookupHelper.php index 54352bde9..4d75f0ef0 100644 --- a/app/Library/Lookups/NewLookupHelper.php +++ b/app/Library/Lookups/NewLookupHelper.php @@ -7,10 +7,6 @@ use DB; use Log; //Library -use Seat\Eseye\Cache\NullCache; -use Seat\Eseye\Configuration; -use Seat\Eseye\Containers\EsiAuthentication; -use Seat\Eseye\Eseye; use Seat\Eseye\Exceptions\RequestFailedException; use App\Library\Esi\Esi; @@ -30,7 +26,10 @@ class NewLookupHelper { //Construct public function __construct() { - $this->esi = new Eseye(); + //Declare a variable for use by the construct + $esiHelper = new Esi; + + $this->esi = $esiHelper->SetupEsiAuthentication(); } public function ItemIdToName($itemId) { diff --git a/app/Library/Moons/MiningLedgerHelper.php b/app/Library/Moons/MiningLedgerHelper.php index 3fccaddfb..eee9ae2c7 100644 --- a/app/Library/Moons/MiningLedgerHelper.php +++ b/app/Library/Moons/MiningLedgerHelper.php @@ -13,10 +13,6 @@ use Log; use DB; //App Library -use Seat\Eseye\Cache\NullCache; -use Seat\Eseye\Configuration; -use Seat\Eseye\Containers\EsiAuthentication; -use Seat\Eseye\Eseye; use Seat\Eseye\Exceptions\RequestFailedException; use App\Library\Esi\Esi; use App\Library\Lookups\NewLookupHelper; diff --git a/database/seeds/SolarSystemSeeder.php b/database/seeds/SolarSystemSeeder.php index 824b6f9cc..a4d13080f 100644 --- a/database/seeds/SolarSystemSeeder.php +++ b/database/seeds/SolarSystemSeeder.php @@ -4,10 +4,8 @@ use Illuminate\Database\Seeder; use App\Models\Lookups\SolarSystem; -use Seat\Eseye\Cache\NullCache; -use Seat\Eseye\Configuration; -use Seat\Eseye\Containers\EsiAuthentication; -use Seat\Eseye\Eseye; +use Seat\Eseye\Exceptions\RequestFailedException; +use App\Library\Esi\Esi; class SolarSystemSeeder extends Seeder { @@ -18,10 +16,10 @@ class SolarSystemSeeder extends Seeder */ public function run() { - $configuration = Configuration::getInstance(); - $configuration->cache = NullCache::class; + //Declare some variables + $esiHelper = new Esi; - $esi = new Eseye(); + $esi = $esiHelper->SetupEsiAuthentication(); $systems = $esi->invoke('get', '/universe/systems/');