mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-09-01 21:00:58 +00:00
* refactor: stabilize model identities for domain migration * refactor: extract module platform context * refactor: assign models to domain contexts * refactor: extract ai platform context * refactor: extract storage platform context * refactor: extract mail platform context * refactor: extract pdf platform context * refactor: extract operations platform context * refactor: move installation into operations platform * refactor: extract money domain context * refactor: extract taxation domain context * refactor: extract catalog domain context * refactor: extract metadata domain context * refactor: extract reporting domain context * refactor: extract purchases domain context * refactor: extract receivables domain context * refactor: extract accounts domain context * refactor: complete reporting statement boundary * refactor: extract contacts domain context * refactor: extract sales domain context * refactor: remove legacy application layers * fix: migrate legacy bouncer role identities
40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Domains\Reporting\Mail;
|
|
|
|
use App\Platform\Mail\Models\EmailLog;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Mail\Mailable;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class SendCustomerStatementMail extends Mailable
|
|
{
|
|
use Queueable, SerializesModels;
|
|
|
|
public array $data;
|
|
|
|
public function __construct(array $data)
|
|
{
|
|
$this->data = $data;
|
|
}
|
|
|
|
public function build()
|
|
{
|
|
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' => $this->data['customer']->getMorphClass(),
|
|
'mailable_id' => $this->data['customer']->id,
|
|
]);
|
|
|
|
return $this->from($this->data['from'], $this->data['from_name'])
|
|
->subject($this->data['subject'])
|
|
->markdown('emails.send.customer-statement', ['data' => $this->data])
|
|
->attachData($this->data['pdf']->output(), $this->data['filename']);
|
|
}
|
|
}
|