diff --git a/app/Console/Commands/SendInvoiceReport.php b/app/Console/Commands/SendInvoiceReport.php index bee61c9..26a5ef1 100644 --- a/app/Console/Commands/SendInvoiceReport.php +++ b/app/Console/Commands/SendInvoiceReport.php @@ -352,6 +352,16 @@ class SendInvoiceReport extends Command ->toArray(); } + // Prevent empty mails + if ( + empty($filteredSerialData) && + empty($filteredMaterialData) && + empty($filteredBundleData) + ) { + $this->warn("Skipping empty mail for rule {$rule->id}"); + continue; + } + \Mail::to($toEmails) ->cc($ccEmails) ->send(new test(