Move attachments into data

This commit is contained in:
David Bomba 2022-12-15 08:39:27 +11:00
parent 3e04be5d1d
commit 66e4270531
2 changed files with 3 additions and 6 deletions

View File

@ -138,11 +138,11 @@ class InvoiceEmailEngine extends BaseEmailEngine
// Storage::url
foreach ($this->invoice->documents as $document) {
$this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, ]]);
$this->setAttachments([['file' => base64_encode($document->getFile()), 'path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, ]]);
}
foreach ($this->invoice->company->documents as $document) {
$this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, ]]);
$this->setAttachments([['file' => base64_encode($document->getFile()), 'path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, ]]);
}
$line_items = $this->invoice->line_items;

View File

@ -118,10 +118,7 @@ class TemplateEmail extends Mailable
'logo' => $this->company->present()->logo($settings),
]);
nlog($this->build_email->getAttachments());
foreach (array_reverse($this->build_email->getAttachments()) as $file) {
foreach ($this->build_email->getAttachments() as $file) {
if(array_key_exists('file', $file))
$this->attachData(base64_decode($file['file']), $file['name']);
else