Refactor content method in InvoiceDataMail to use null-safe operator for document_date check
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / review (pull_request) Failing after 29s
Laravel Larastan / larastan (pull_request) Failing after 2m44s
Laravel Pint / pint (pull_request) Failing after 2m34s

This commit is contained in:
dhanabalan
2025-11-29 18:27:56 +05:30
parent 9fa73b2ecc
commit 5f4494f5aa

View File

@@ -48,11 +48,10 @@ class InvoiceDataMail extends Mailable
$greeting = 'Dear Sir/Madam,<br><br>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 {