From c2527c56b58e15e9b360f8980b451607c5427d38 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 11 Feb 2021 22:37:58 +1100 Subject: [PATCH] Gmail --- app/Console/Commands/CheckData.php | 14 +++++++------- app/Helpers/Mail/GmailTransportManager.php | 4 +++- app/Jobs/Mail/BaseMailerJob.php | 3 +++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/Console/Commands/CheckData.php b/app/Console/Commands/CheckData.php index fb8c092fc3..8b4ab13175 100644 --- a/app/Console/Commands/CheckData.php +++ b/app/Console/Commands/CheckData.php @@ -303,14 +303,14 @@ class CheckData extends Command $total_invoice_payments += ($total_amount - $total_refund); } - //10/02/21 - // foreach ($client->payments as $payment) { - // $credit_total_applied += $payment->paymentables->where('paymentable_type', App\Models\Credit::class)->sum(DB::raw('amount')); - // } + // 10/02/21 + foreach ($client->payments as $payment) { + $credit_total_applied += $payment->paymentables->where('paymentable_type', App\Models\Credit::class)->sum(DB::raw('amount')); + } - // if ($credit_total_applied < 0) { - // $total_invoice_payments += $credit_total_applied; - // } + if ($credit_total_applied < 0) { + $total_invoice_payments += $credit_total_applied; + } if (round($total_invoice_payments, 2) != round($client->paid_to_date, 2)) { diff --git a/app/Helpers/Mail/GmailTransportManager.php b/app/Helpers/Mail/GmailTransportManager.php index d264f1de76..767f5fc6bd 100644 --- a/app/Helpers/Mail/GmailTransportManager.php +++ b/app/Helpers/Mail/GmailTransportManager.php @@ -5,6 +5,7 @@ namespace App\Helpers\Mail; use Illuminate\Mail\MailManager; use App\CustomMailDriver\CustomTransport; use Dacastro4\LaravelGmail\Services\Message\Mail; +use Illuminate\Support\Facades\Config; class GmailTransportManager extends MailManager @@ -12,7 +13,8 @@ class GmailTransportManager extends MailManager protected function createGmailTransport() { - $token = $this->app['config']->get('services.gmail.token', []); + //$token = $this->app['config']->get('services.gmail.token', []); + $token =Config::get('services.gmail.token'); $mail = new Mail; return new GmailTransport($mail, $token); diff --git a/app/Jobs/Mail/BaseMailerJob.php b/app/Jobs/Mail/BaseMailerJob.php index 04a48bf1ae..0c8a9e7709 100644 --- a/app/Jobs/Mail/BaseMailerJob.php +++ b/app/Jobs/Mail/BaseMailerJob.php @@ -86,6 +86,9 @@ class BaseMailerJob implements ShouldQueue Config::set('mail.from.name', $user->present()->name()); (new MailServiceProvider(app()))->register(); + + nlog("after registering mail service provider"); + nlog(Config::set('services.gmail.token')); } public function logMailError($errors, $recipient_object)