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-assets.read_corporation_assets.v1 failed."); return null; } //Get the refresh token from the database $token = $esiHelper->GetRefreshToken($charId); //Create the authentication container $esi = $esiHelper->SetupEsiAuthentication($token); 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++) { ProcessAssetsJob::dispatch($charId, $corpId, $i)->onQueue('assets'); } } }