SetStartStatus(); //Set the date $date = Carbon::now()->subMonth(); //Set the mail helper variable $mHelper = new Mail(); //Get the full list of bills to send out $bills = MonthlyMarketTax::where(['month' => $date->monthName, 'year' => $date->year])->get(); //For each of the bills send a mail out foreach($bills as $bill) { //Send a mail out with the bill $subject = 'Market Taxes Owed'; $body = 'Month: ' . $bill->month . '
Market Taxes Owed: ' . $bills->tax_owed . '
Please remit to Spatial Forces'; $error = $mHelper->SendMail($bills->character_id, $bills->tax_owed, $subject, $body); } //Mark the job as finished $task->SetStopStatus(); } }