'Pending', ])->get(); //Cycle through the invoices, and see if they are late or not. foreach($invoices as $invoice) { $dueDate = Carbon::create($invoice->date_due); if($dueDate->greaterThan($today->subDays(7))) { //Update the invoice in the database Invoice::where([ 'invoice_id' => $invoice->invoice_id, ])->update([ 'status' => 'Late', ]); //Build the mail $subject = 'Warped Intentions Mining Taxes - Invoice Late'; $sender = $config['primary']; $recipientType = 'character'; $recipient = $invoice->character_id; $body = "Dear " . $invoice->character_name . ",

"; $body .= "The Mining Invoice: " . $invoice->invoice_id . " is late.
"; $body .= "Please remite " . number_format($invoice->invoice_amount, 2, ".", ",") . "to Spatial Forces.
"; $body .= "
Sincerely,
Warped Intentions Leadership
"; //Send a reminder to the user through eve mail about the late invoice SendEveMail::dispatch($body, $recipient, $recipientType, $subject, $sender)->onQueue('mail')->delay(Carbon::now()->addSeconds($mailDelay)); } } } }