SetStartStatus(); //Setup the Finances Container $finance = new FinanceHelper(); //Setup an array to store corporations which have been logged so we don't keep calling the same ones. We need //this step in order to save time during the cronjob. $finishedCorps = array(); $corpCompleted = false; //Get the corps with structures logged in the database $corps = CorpStructure::select('corporation_id')->groupBy('corporation_id')->get(); /* foreach($corps as $corp) { $charId = CorpStructure::where(['corporation_id' => $corp->corporation_id])->first(); $finance->GetWalletJournal(1, $charId->character_id); } */ //Get the corps with structures, and dispatch jobs accordingly foreach($corps as $corp) { $charId = CorpStructure::where(['corporation_id' => $corp->corporation_id])->first(); $pages = $finance->GetJournalPageCount(1, $charId->character_id); for($i = 1; $i <= $pages; $i++) { $job = new JobProcessWalletJournal; $job->division = 1; $job->charId = $charId->character_id; $job->page = $i; $job->save(); ProcessWalletJournalJob::dispatch($job); } } //Mark the job as finished $task->SetStopStatus(); } }