company->db); $this->user->setCompany($this->company); RecurringInvoice::query()->where('company_id', $this->company->id) ->whereIn('id', $this->ids) ->chunk(100, function ($recurring_invoices) { foreach ($recurring_invoices as $recurring_invoice) { if ($this->action == 'update_prices') { $recurring_invoice->service()->updatePrice(); } elseif ($this->action == 'increase_prices') { $recurring_invoice->service()->increasePrice($this->percentage); } } }); event(new RefetchEntity('recurring_invoices', null, $this->user)); } public function failed($exception = null) { if($exception) nlog($exception->getMessage()); } }