Update startDate logic in InvoiceDataMail content method to handle null document_date
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 12s
Gemini PR Review / review (pull_request) Failing after 21s
Laravel Pint / pint (pull_request) Successful in 2m15s
Laravel Larastan / larastan (pull_request) Failing after 3m7s

This commit is contained in:
dhanabalan
2025-11-29 17:54:12 +05:30
parent 53f0a7bfdf
commit ff8aa8b536

View File

@@ -51,9 +51,12 @@ class InvoiceDataMail extends Mailable
$firstRecord = InvoiceDataValidation::orderBy('document_date', 'asc')->first(); $firstRecord = InvoiceDataValidation::orderBy('document_date', 'asc')->first();
// $lastRecord = InvoiceDataValidation::orderBy('document_date', 'desc')->first(); // $lastRecord = InvoiceDataValidation::orderBy('document_date', 'desc')->first();
if ($firstRecord) { $startDate = null;
if ($firstRecord && $firstRecord->document_date != null && $firstRecord->document_date != '') {
$startDate = \Carbon\Carbon::parse($firstRecord->document_date)->startOfDay(); $startDate = \Carbon\Carbon::parse($firstRecord->document_date)->startOfDay();
// $endDate = \Carbon\Carbon::parse($lastRecord->document_date)->endOfDay(); // $endDate = \Carbon\Carbon::parse($lastRecord->document_date)->endOfDay();
} else {
$startDate = now()->subDay()->setTime(10, 0, 0);
} }
$endDate = now()->setTime(10, 0, 0); $endDate = now()->setTime(10, 0, 0);