mirror of
https://github.com/crater-invoice/crater.git
synced 2025-12-15 09:52:55 -05:00
Send Invoices/Estimates/Payments as email attachments
This commit is contained in:
@@ -124,8 +124,9 @@ class Payment extends Model implements HasMedia
|
||||
$data['user'] = $this->user->toArray();
|
||||
$data['company'] = Company::find($this->company_id);
|
||||
$data['body'] = $this->getEmailBody($data['body']);
|
||||
$pdfData = ($this->getEmailAttachmentSetting()) ? $this->getPDFData() : null;
|
||||
|
||||
\Mail::to($data['to'])->send(new SendPaymentMail($data));
|
||||
\Mail::to($data['to'])->send(new SendPaymentMail($data, $pdfData));
|
||||
|
||||
return [
|
||||
'success' => true
|
||||
@@ -400,6 +401,17 @@ class Payment extends Model implements HasMedia
|
||||
return $this->getFormattedString($format);
|
||||
}
|
||||
|
||||
public function getEmailAttachmentSetting()
|
||||
{
|
||||
$paymentAsAttachment = CompanySetting::getSetting('payment_email_attachment', $this->company_id);
|
||||
|
||||
if($paymentAsAttachment == 'NO') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getNotes()
|
||||
{
|
||||
return $this->getFormattedString($this->notes);
|
||||
|
||||
Reference in New Issue
Block a user