From 017f57878dc7d148fd3756048f8d99d2ce02c7d7 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Wed, 20 May 2026 17:08:30 +0530 Subject: [PATCH] Added logic to prevent empty mails for invoice report --- app/Console/Commands/SendInvoiceReport.php | 10 ++++++++++ 1 file changed, 10 insertions(+) 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(