mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-19 11:14:06 +00:00
feat(mail): add CC and BCC fields to email requests and forms (#466)
* feat(mail): add CC and BCC fields to email requests and forms * chore: fmt
This commit is contained in:
committed by
GitHub
parent
796f6f364a
commit
65d1fdd3f0
@@ -32,6 +32,12 @@ class SendEstimatesRequest extends FormRequest
|
||||
'to' => [
|
||||
'required',
|
||||
],
|
||||
'cc' => [
|
||||
'nullable',
|
||||
],
|
||||
'bcc' => [
|
||||
'nullable',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,12 @@ class SendInvoiceRequest extends FormRequest
|
||||
'to' => [
|
||||
'required',
|
||||
],
|
||||
'cc' => [
|
||||
'nullable',
|
||||
],
|
||||
'bcc' => [
|
||||
'nullable',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,12 @@ class SendPaymentRequest extends FormRequest
|
||||
'to' => [
|
||||
'required',
|
||||
],
|
||||
'cc' => [
|
||||
'nullable',
|
||||
],
|
||||
'bcc' => [
|
||||
'nullable',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@ class SendEstimateMail extends Mailable
|
||||
$log = EmailLog::create([
|
||||
'from' => $this->data['from'],
|
||||
'to' => $this->data['to'],
|
||||
'cc' => $this->data['cc'] ?? null,
|
||||
'bcc' => $this->data['bcc'] ?? null,
|
||||
'subject' => $this->data['subject'],
|
||||
'body' => $this->data['body'],
|
||||
'mailable_type' => Estimate::class,
|
||||
|
||||
@@ -36,6 +36,8 @@ class SendInvoiceMail extends Mailable
|
||||
$log = EmailLog::create([
|
||||
'from' => $this->data['from'],
|
||||
'to' => $this->data['to'],
|
||||
'cc' => $this->data['cc'] ?? null,
|
||||
'bcc' => $this->data['bcc'] ?? null,
|
||||
'subject' => $this->data['subject'],
|
||||
'body' => $this->data['body'],
|
||||
'mailable_type' => Invoice::class,
|
||||
|
||||
@@ -36,6 +36,8 @@ class SendPaymentMail extends Mailable
|
||||
$log = EmailLog::create([
|
||||
'from' => $this->data['from'],
|
||||
'to' => $this->data['to'],
|
||||
'cc' => $this->data['cc'] ?? null,
|
||||
'bcc' => $this->data['bcc'] ?? null,
|
||||
'subject' => $this->data['subject'],
|
||||
'body' => $this->data['body'],
|
||||
'mailable_type' => Payment::class,
|
||||
|
||||
@@ -374,7 +374,14 @@ class Estimate extends Model implements HasMedia
|
||||
$this->save();
|
||||
}
|
||||
|
||||
\Mail::to($data['to'])->send(new SendEstimateMail($data));
|
||||
$mail = \Mail::to($data['to']);
|
||||
if (! empty($data['cc'])) {
|
||||
$mail->cc($data['cc']);
|
||||
}
|
||||
if (! empty($data['bcc'])) {
|
||||
$mail->bcc($data['bcc']);
|
||||
}
|
||||
$mail->send(new SendEstimateMail($data));
|
||||
|
||||
return [
|
||||
'success' => true,
|
||||
|
||||
@@ -464,7 +464,14 @@ class Invoice extends Model implements HasMedia
|
||||
{
|
||||
$data = $this->sendInvoiceData($data);
|
||||
|
||||
\Mail::to($data['to'])->send(new SendInvoiceMail($data));
|
||||
$mail = \Mail::to($data['to']);
|
||||
if (! empty($data['cc'])) {
|
||||
$mail->cc($data['cc']);
|
||||
}
|
||||
if (! empty($data['bcc'])) {
|
||||
$mail->bcc($data['bcc']);
|
||||
}
|
||||
$mail->send(new SendInvoiceMail($data));
|
||||
|
||||
if ($this->status == Invoice::STATUS_DRAFT) {
|
||||
$this->status = Invoice::STATUS_SENT;
|
||||
|
||||
@@ -144,7 +144,14 @@ class Payment extends Model implements HasMedia
|
||||
{
|
||||
$data = $this->sendPaymentData($data);
|
||||
|
||||
\Mail::to($data['to'])->send(new SendPaymentMail($data));
|
||||
$mail = \Mail::to($data['to']);
|
||||
if (! empty($data['cc'])) {
|
||||
$mail->cc($data['cc']);
|
||||
}
|
||||
if (! empty($data['bcc'])) {
|
||||
$mail->bcc($data['bcc']);
|
||||
}
|
||||
$mail->send(new SendPaymentMail($data));
|
||||
|
||||
return [
|
||||
'success' => true,
|
||||
|
||||
Reference in New Issue
Block a user