first change
This commit is contained in:
73
Modules/Template/app/Emails/SendMail.php
Normal file
73
Modules/Template/app/Emails/SendMail.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Template\Emails;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Attachment;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class SendMail extends Mailable implements ShouldQueue
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $data;
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
*/
|
||||
// public function build(): self
|
||||
// {
|
||||
// return $this->view('mail.template');
|
||||
// }
|
||||
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: $this->data['subject'],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
public function content(): Content
|
||||
{
|
||||
return new Content(
|
||||
view: 'mail.template'
|
||||
);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Get the attachments for the message.
|
||||
// *
|
||||
// * @return array
|
||||
// */
|
||||
public function attachments(): array
|
||||
{
|
||||
$attachments = [];
|
||||
if (isset($this->data['documentPaths'])) {
|
||||
foreach ($this->data['documentPaths'] as $path) {
|
||||
$attachments[] = Attachment::fromPath($path);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->data['mergePdf'])) {
|
||||
$attachments[] = Attachment::fromPath($this->data['mergePdf']);
|
||||
|
||||
}
|
||||
|
||||
return $attachments;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user