SetStartStatus(); //Setup the esi authentication container $config = config('esi'); //Declare some variables $charId = $config['primary']; $corpId = 98287666; //ESI Scope Check $esiHelper = new Esi(); $assetScope = $esiHelper->HaveEsiScope($config['primary'], 'esi-assets.read_corporation_assets.v1'); if($assetScope == false) { Log::critical("Scope check for esi failed."); return null; } // Disable all caching by setting the NullCache as the // preferred cache handler. By default, Eseye will use the // FileCache. $configuration = Configuration::getInstance(); $configuration->cache = NullCache::class; //Get the refresh token from the database $token = EsiToken::where(['character_id' => $charId])->get(['refresh_token']); //Create the authentication container $authentication = new EsiAuthentication([ 'client_id' => $config['client_id'], 'secret' => $config['secret'], 'refresh_token' => $token[0]->refresh_token, ]); $esi = new Eseye($authentication); try { $assets = $esi->page(1) ->invoke('get', '/corporations/{corporation_id}/assets/', [ 'corporation_id' => $corpId, ]); } catch (RequestFailedException $e) { Log::critical("Failed to get asset list."); return null; } $pages = $assets->pages; /* for($i = 1; $i < $pages; $i++) { $job = new JobProcessAsset; $job->charId = $charId; $job->corpId = $corpId; $job->page = $i; ProcessAssetsJob::dispatch($job)->onQueue('assets'); } */ for($i = 1; $i < $pages; $i++) { $aHelper = new AssetHelper($charId, $corpId); //Get a page of assets $assets = $aHelper->GetAssetsByPage($i); foreach($assets as $asset) { $aHelper->StoreNewAsset($asset); } } } }