BCC invoice emails to the admin
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 49s
Create Docker Image / Final Docker Image Manifest (push) Successful in 11s

This commit is contained in:
Deon George 2024-09-19 18:45:46 +10:00
parent a65c81871b
commit 3fc676fa26

View File

@ -9,7 +9,7 @@ use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope; use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
use App\Models\Invoice; use App\Models\{Invoice,User};
class InvoiceEmail extends Mailable implements ShouldQueue class InvoiceEmail extends Mailable implements ShouldQueue
{ {
@ -33,7 +33,11 @@ class InvoiceEmail extends Mailable implements ShouldQueue
*/ */
public function envelope(): Envelope 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( return new Envelope(
bcc: $uo->email,
subject: sprintf('Invoice %d for services, due %s', subject: sprintf('Invoice %d for services, due %s',
$this->io->lid, $this->io->lid,
$this->io->due_at->format('Y-m-d')), $this->io->due_at->format('Y-m-d')),