From 92c28d9d67f1f7757dbf3f7c50472091760d5e14 Mon Sep 17 00:00:00 2001 From: Martin Folkerts Date: Thu, 1 Feb 2024 15:34:53 +0100 Subject: [PATCH] okay --- laravel_app/app/Mail/ReportMailer.php | 3 ++- laravel_app/app/Models/ProjectMailing.php | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/laravel_app/app/Mail/ReportMailer.php b/laravel_app/app/Mail/ReportMailer.php index 8ec28b0..12fb061 100644 --- a/laravel_app/app/Mail/ReportMailer.php +++ b/laravel_app/app/Mail/ReportMailer.php @@ -26,7 +26,8 @@ class ReportMailer extends Mailable public function __construct(ProjectMailing $mailing) { $this->mailing = $mailing; - $this->to($mailing->recipients()->pluck('email')->toArray()); +// logger($mailing->recipients()->pluck('email')->toArray()); +// $this->to(['martin@sobit.nl', ...($mailing->recipients()->pluck('email')->toArray())]); } /** diff --git a/laravel_app/app/Models/ProjectMailing.php b/laravel_app/app/Models/ProjectMailing.php index 43e5744..03ce30a 100644 --- a/laravel_app/app/Models/ProjectMailing.php +++ b/laravel_app/app/Models/ProjectMailing.php @@ -21,7 +21,11 @@ class ProjectMailing extends Model protected static function booted() { static::created(function (ProjectMailing $projectMailing) { - Mail::to($projectMailing->recipients()->pluck('email')->toArray()) + $toAddresses = $projectMailing->recipients()->pluck('email')->toArray(); + logger('created'); + logger($projectMailing); + + Mail::to($toAddresses) ->send(new \App\Mail\ReportMailer($projectMailing)); }); }