70 lines
1.5 KiB
PHP
70 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Mail\Customer;
|
|
|
|
use App\Models\Template;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Mail\Mailable;
|
|
use Illuminate\Mail\Mailables\Content;
|
|
use Illuminate\Mail\Mailables\Envelope;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class CustomerPayment extends Mailable
|
|
{
|
|
use Queueable, SerializesModels;
|
|
|
|
protected $template;
|
|
protected $data;
|
|
|
|
/**
|
|
* Create a new message instance.
|
|
*/
|
|
public function __construct($template = 0, $data = [])
|
|
{
|
|
$this->data = $data;
|
|
$this->template = Template::find($template);
|
|
}
|
|
|
|
/**
|
|
* Get the message envelope.
|
|
*/
|
|
public function envelope(): Envelope
|
|
{
|
|
return new Envelope(
|
|
subject: $this->template->subject,
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get the message content definition.
|
|
*/
|
|
public function content(): Content
|
|
{
|
|
return new Content(
|
|
view: 'emails.template',
|
|
with: [
|
|
'template' => str_replace(
|
|
[
|
|
"{\$company_name}",
|
|
"{\$company_logo}",
|
|
],
|
|
[
|
|
$this->data['company_name'],
|
|
$this->data['company_logo'],
|
|
],
|
|
$this->template->message)
|
|
]
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get the attachments for the message.
|
|
*
|
|
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
|
*/
|
|
public function attachments(): array
|
|
{
|
|
return [];
|
|
}
|
|
}
|