connection = 'redis'; $this->onQueue('miningtaxes'); } /** * Execute the job. * * @return void */ public function handle() { $count = MiningOperation::where([ 'processed' => 'No', ])->where('operation_date', '<=', Carbon::now()) ->count(); if($count > 0) { $operations = MiningOperation::where([ 'processed' => 'No', ])->where('operation_date', '<=', Carbon::now()) ->get(); foreach($operations as $operation) { $ledgers = Ledger::where([ 'observer_id' => $operation->structure_id, 'invoiced' => 'No', 'last_updated' => $operation->operation_date, ])->get(); foreach($ledgers as $ledger) { Ledger::where([ 'observer_id' => $operation->structure_id, 'invoiced' => 'No', 'last_updated' => $operation->operation_date, ])->update([ 'invoiced' => 'Yes', 'invoice_id' => 'MiningOp' . $operation->id, ]); } MiningOperation::where([ 'id' => $operation->id, ])->update([ 'processed' => 'Yes', 'processed_on' => Carbon::now(), ]); } } } /** * Set the tags for Horzion * * @var array */ public function tags() { return ['ProcessAllianceMiningOperations', 'MiningTaxes', 'MiningOperations']; } }