wip
This commit is contained in:
parent
92c28d9d67
commit
8905c18df3
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
use App\Models\ProjectMailing;
|
use App\Models\ProjectMailing;
|
||||||
use App\Models\ProjectReport;
|
use App\Models\ProjectReport;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
use Livewire\Attributes\Rule;
|
use Livewire\Attributes\Rule;
|
||||||
use Livewire\Form;
|
use Livewire\Form;
|
||||||
|
|
||||||
|
|
@ -46,5 +47,10 @@ public function save()
|
||||||
$mailing->recipients()->createMany($this->recipients);
|
$mailing->recipients()->createMany($this->recipients);
|
||||||
|
|
||||||
$this->setReport($this->report);
|
$this->setReport($this->report);
|
||||||
|
|
||||||
|
|
||||||
|
Mail::to($mailing->recipients()->pluck('email')->toArray())
|
||||||
|
->send(new \App\Mail\ReportMailer($mailing));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,6 @@ class ReportMailer extends Mailable
|
||||||
public function __construct(ProjectMailing $mailing)
|
public function __construct(ProjectMailing $mailing)
|
||||||
{
|
{
|
||||||
$this->mailing = $mailing;
|
$this->mailing = $mailing;
|
||||||
// logger($mailing->recipients()->pluck('email')->toArray());
|
|
||||||
// $this->to(['martin@sobit.nl', ...($mailing->recipients()->pluck('email')->toArray())]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -18,17 +18,6 @@ class ProjectMailing extends Model
|
||||||
'message',
|
'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)
|
public function addAttachment($name, UploadedFile $file)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue