This commit is contained in:
Martin Folkerts 2024-02-01 17:02:53 +01:00
parent 92c28d9d67
commit 8905c18df3
3 changed files with 6 additions and 13 deletions

View file

@ -4,6 +4,7 @@
use App\Models\ProjectMailing;
use App\Models\ProjectReport;
use Illuminate\Support\Facades\Mail;
use Livewire\Attributes\Rule;
use Livewire\Form;
@ -46,5 +47,10 @@ public function save()
$mailing->recipients()->createMany($this->recipients);
$this->setReport($this->report);
Mail::to($mailing->recipients()->pluck('email')->toArray())
->send(new \App\Mail\ReportMailer($mailing));
}
}

View file

@ -26,8 +26,6 @@ class ReportMailer extends Mailable
public function __construct(ProjectMailing $mailing)
{
$this->mailing = $mailing;
// logger($mailing->recipients()->pluck('email')->toArray());
// $this->to(['martin@sobit.nl', ...($mailing->recipients()->pluck('email')->toArray())]);
}
/**

View file

@ -18,17 +18,6 @@ class ProjectMailing extends Model
'message',
];
protected static function booted()
{
static::created(function (ProjectMailing $projectMailing) {
$toAddresses = $projectMailing->recipients()->pluck('email')->toArray();
logger('created');
logger($projectMailing);
Mail::to($toAddresses)
->send(new \App\Mail\ReportMailer($projectMailing));
});
}
public function addAttachment($name, UploadedFile $file)
{