diff --git a/app/Mail/InvoiceDataMail.php b/app/Mail/InvoiceDataMail.php index 4fc64d7..4f39c57 100644 --- a/app/Mail/InvoiceDataMail.php +++ b/app/Mail/InvoiceDataMail.php @@ -48,11 +48,10 @@ class InvoiceDataMail extends Mailable $greeting = 'Dear Sir/Madam,

We are sending here with list of "Despatch pending sale invoice & STO invoice as on date"'; if ($this->scheduleType == 'Daily') { - $firstRecord = InvoiceDataValidation::orderBy('document_date', 'asc')->first(); - // $lastRecord = InvoiceDataValidation::orderBy('document_date', 'desc')->first(); + $firstRecord = InvoiceDataValidation::orderBy('document_date', 'asc')->first(); // 'desc' $startDate = null; - if ($firstRecord && $firstRecord->document_date != null && $firstRecord->document_date != '') { + if ($firstRecord && $firstRecord?->document_date != null && $firstRecord?->document_date != '') { $startDate = \Carbon\Carbon::parse($firstRecord->document_date)->startOfDay(); // $endDate = \Carbon\Carbon::parse($lastRecord->document_date)->endOfDay(); } else {