This commit is contained in:
Martin Folkerts 2024-02-01 15:34:53 +01:00
parent 7aacad4e09
commit 92c28d9d67
2 changed files with 7 additions and 2 deletions

View file

@ -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())]);
}
/**

View file

@ -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));
});
}