report = $report; $this->subject = $report->project->mail_subject; $this->message = $report->project->mail_template; $this->recipients = $this->report->project->emailRecipients()->get(['email', 'name'])->toArray(); } public function save() { $this->validate(); $mailing = $this->report->project->mailings()->create([ 'subject' => $this->subject, 'message' => $this->message, ]); $mailing->attachments()->create([ 'name' => $this->report->name, 'path' => $this->report->path, ]); $mailing->recipients()->createMany($this->recipients); $this->setReport($this->report); } }