feat: Reorganize database migrations for module snapshots, VMware, and OS groups, and implement customer order creation email notifications.
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?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 OrderCreated extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
protected Template $template;
|
||||
protected array $data;
|
||||
|
||||
public function __construct(Template $template, array $data)
|
||||
{
|
||||
$this->template = $template;
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: $this->template->subject,
|
||||
);
|
||||
}
|
||||
|
||||
public function content(): Content
|
||||
{
|
||||
$message = str_replace(
|
||||
[
|
||||
'{\$company_name}',
|
||||
'{\$company_logo}',
|
||||
'{\$client_name}',
|
||||
'{\$order_num}',
|
||||
'{\$order_total}',
|
||||
'{\$invoice_num}',
|
||||
],
|
||||
[
|
||||
$this->data['company_name'],
|
||||
$this->data['company_logo'],
|
||||
$this->data['client_name'],
|
||||
$this->data['order_num'],
|
||||
$this->data['order_total'],
|
||||
$this->data['invoice_num'],
|
||||
],
|
||||
$this->template->message
|
||||
);
|
||||
|
||||
return new Content(
|
||||
view: 'emails.template',
|
||||
with: ['template' => $message],
|
||||
);
|
||||
}
|
||||
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user