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(RequestFailedException $e){ dd($e->getEsiResponse()); } //Delete all of the entries in the AllianceCorps table AllianceCorp::truncate(); //Foreach corporation, make entries into the database. foreach($corporations as $corp) { try { $corpInfo = $esi->invoke('get', '/corporations/{corporation_id}/', [ 'corporation_id' => $corp, ]); } catch(RequestFailedException $e) { return $e->getEsiResponse(); } $entry = new AllianceCorp; $entry->corporation_id = $corp; $entry->name = $corpInfo->name; $entry->save(); } } }