feat(emails): implemented sending invoice, estimates and payments as attachements

This commit is contained in:
Sebastian Cretu
2021-03-02 21:49:03 +01:00
parent 1932c5a75e
commit 2b78aacc83
15 changed files with 47 additions and 75 deletions

View File

@ -13,17 +13,15 @@ class SendEstimateMail extends Mailable
use Queueable, SerializesModels;
public $data = [];
public $pdfData;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($data, $pdfData)
public function __construct($data)
{
$this->data = $data;
$this->pdfData = $pdfData;
}
/**
@ -42,22 +40,15 @@ class SendEstimateMail extends Mailable
'mailable_id' => $this->data['estimate']['id']
]);
<<<<<<< HEAD
$mailContent = $this->from($this->data['from'])
->subject($this->data['subject'])
->markdown('emails.send.estimate', ['data', $this->data]);
=======
return $this->from($this->data['from'], config('mail.from.name'))
$mailContent = $this->from($this->data['from'], config('mail.from.name'))
->subject($this->data['subject'])
->markdown('emails.send.estimate', ['data', $this->data]);
>>>>>>> master
if ($this->pdfData) {
if ($this->data['attach']['data'])
$mailContent->attachData(
$this->pdfData->output(),
$this->data['attach']['data']->output(),
$this->data['estimate']['estimate_number'] . '.pdf'
);
}
return $mailContent;
}

View File

@ -14,17 +14,15 @@ class SendInvoiceMail extends Mailable
use Queueable, SerializesModels;
public $data = [];
public $pdfData;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($data, $pdfData)
public function __construct($data)
{
$this->data = $data;
$this->pdfData = $pdfData;
}
/**
@ -43,23 +41,16 @@ class SendInvoiceMail extends Mailable
'mailable_id' => $this->data['invoice']['id']
]);
$mailContent = $this->from($this->data['from'])
$mailContent = $this->from($this->data['from'], config('mail.from.name'))
->subject($this->data['subject'])
->markdown('emails.send.invoice', ['data', $this->data]);
<<<<<<< HEAD
if ($this->pdfData) {
if ($this->data['attach']['data'])
$mailContent->attachData(
$this->pdfData->output(),
$this->data['attach']['data']->output(),
$this->data['invoice']['invoice_number'] . '.pdf'
);
}
return $mailContent;
=======
return $this->from($this->data['from'], config('mail.from.name'))
->subject($this->data['subject'])
->markdown('emails.send.invoice', ['data', $this->data]);
>>>>>>> master
}
}

View File

@ -14,17 +14,15 @@ class SendPaymentMail extends Mailable
use Queueable, SerializesModels;
public $data = [];
public $pdfData;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct($data, $pdfData)
public function __construct($data)
{
$this->data = $data;
$this->pdfData = $pdfData;
}
/**
@ -43,24 +41,16 @@ class SendPaymentMail extends Mailable
'mailable_id' => $this->data['payment']['id']
]);
<<<<<<< HEAD
$mailContent = $this->from($this->data['from'])
->subject($this->data['subject'])
->markdown('emails.send.payment', ['data', $this->data]);
if ($this->pdfData) {
$mailContent->attachData(
$this->pdfData->output(),
$this->data['payment']['payment_number'] . '.pdf'
);
}
return $mailContent;
=======
return $this->from($this->data['from'], config('mail.from.name'))
$mailContent = $this->from($this->data['from'], config('mail.from.name'))
->subject($this->data['subject'])
->markdown('emails.send.payment', ['data', $this->data]);
>>>>>>> master
if ($this->data['attach']['data'])
$mailContent->attachData(
$this->data['attach']['data']->output(),
$this->data['payment']['payment_number'] . '.pdf'
);
return $mailContent;
}
}