From 7b39edd094bf80f940afa81bdf145b0aa9e1691b Mon Sep 17 00:00:00 2001 From: Martin Folkerts Date: Wed, 31 Jan 2024 21:21:47 +0100 Subject: [PATCH] eod --- laravel_app/app/Mail/ReportMailer.php | 6 ------ laravel_app/app/Models/ProjectMailing.php | 5 +++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/laravel_app/app/Mail/ReportMailer.php b/laravel_app/app/Mail/ReportMailer.php index e099a10..9455a4c 100644 --- a/laravel_app/app/Mail/ReportMailer.php +++ b/laravel_app/app/Mail/ReportMailer.php @@ -47,12 +47,6 @@ public function content(): Content htmlString: $this->mailing->message, ); } - public function build(): self - { - $this->to($this->mailing->recipients()->pluck('email')->toArray()); - - return $this; - } /** * Get the attachments for the message. diff --git a/laravel_app/app/Models/ProjectMailing.php b/laravel_app/app/Models/ProjectMailing.php index 8bb4a2c..43e5744 100644 --- a/laravel_app/app/Models/ProjectMailing.php +++ b/laravel_app/app/Models/ProjectMailing.php @@ -20,8 +20,9 @@ class ProjectMailing extends Model protected static function booted() { - static::created(function ($projectMailing) { - Mail::send(new \App\Mail\ReportMailer($projectMailing)); + static::created(function (ProjectMailing $projectMailing) { + Mail::to($projectMailing->recipients()->pluck('email')->toArray()) + ->send(new \App\Mail\ReportMailer($projectMailing)); }); }