From 3fc676fa26079e6c4c444df512c13fbd58eabbfd Mon Sep 17 00:00:00 2001 From: Deon George Date: Thu, 19 Sep 2024 18:45:46 +1000 Subject: [PATCH] BCC invoice emails to the admin --- app/Mail/InvoiceEmail.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Mail/InvoiceEmail.php b/app/Mail/InvoiceEmail.php index 5b8bdda..a65622a 100644 --- a/app/Mail/InvoiceEmail.php +++ b/app/Mail/InvoiceEmail.php @@ -9,7 +9,7 @@ use Illuminate\Mail\Mailables\Content; use Illuminate\Mail\Mailables\Envelope; use Illuminate\Queue\SerializesModels; -use App\Models\Invoice; +use App\Models\{Invoice,User}; class InvoiceEmail extends Mailable implements ShouldQueue { @@ -33,7 +33,11 @@ class InvoiceEmail extends Mailable implements ShouldQueue */ public function envelope(): Envelope { + // Send an email to an admin that the invoice was created + $uo = User::where('email',config('osb.admin'))->sole(); + return new Envelope( + bcc: $uo->email, subject: sprintf('Invoice %d for services, due %s', $this->io->lid, $this->io->due_at->format('Y-m-d')),