connection = 'redis'; } /** * Execute the job. * * @return void */ public function handle() { //Setup the configuration variable for ESI $config = config('esi'); //Setup the esi helper variable $esiHelper = new Esi; //Check for the esi scope if(!$esiHelper->HaveEsiScope($config['primary'], 'esi-industry.read_corporation_mining.v1')) { //Send a mail to the holding toon to update the esi scopes return null; } //Is this valid? AllianceRentalMoon::update([ 'next_moon_pull' => null, ]); //Reset all table entries to clear out the next moon pull entry $allMoons = AllianceRentalMoon::all(); //Cycle through all of the moons, and make the next moon pull null foreach($allMoons as $moon) { AllianceRentalMoon::where([ 'system' => $moon->system, 'planet' => $moon->planet, 'moon' => $moon->moon, ])->update([ 'next_moon_pull' => null, ]); } //Get the refresh token $token = $esiHelper->GetRefreshToken($config['primary']); //Setup the esi authentication container $esi = $esiHelper->SetupEsiAuthentication($token); try { $responses = $esi->invoke('get', '/corporation/{corporation_id}/mining/extractions/', [ 'corporation_id' => 98287666, ]); } catch(RequestExceptionFailed $e) { return null; } foreach($response as $response) { //Get whether the structure is being used by the alliance or not. $usage = AllianceRentalMoon::where([ 'structure_id' => $response->structure_id, 'rental_type' => 'Alliance', ])->count(); if($usage > 0) { AllianceRentalMoon::where([ 'structure_id' => $response->structure_id, ])->update([ 'next_moon_pull' => $response->chunk_arrival_time, ]); } } } }