feat: add GeneratesUniqueSlug class for unique slug generation
feat: create PostCategoryFactory for generating post category data feat: create PostFactory for generating post data feat: add retry_requested_at column to services table feat: add vcenter provisioning fields to products table feat: add module_host_id to os table feat: create email_notification_templates table for email templates feat: add scenario and format fields to template table feat: add admin fields to transactions table fix: update ticket table columns and types feat: add uuid to ticket table and backfill existing records fix: make ticket_reply user_id nullable feat: create notifications table for user notifications fix: make ticket uuid nullable feat: create post_categories table for blog categories feat: create posts table for blog posts feat: add invoice email template for PDF generation
This commit is contained in:
@@ -4,7 +4,10 @@ namespace App\Jobs\Mail;
|
||||
|
||||
use App\Http\Services\Telegram;
|
||||
use App\Mail\CreateVirtualMachine;
|
||||
use App\Mail\VmCredentialsMail;
|
||||
use App\Models\EmailNotificationTemplate;
|
||||
use App\Models\Invoice;
|
||||
use App\Services\EmailNotificationTemplateRenderer;
|
||||
use App\Services\InvoicePdfService;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
@@ -34,7 +37,8 @@ class SendInformationVirtualMachine implements ShouldQueue
|
||||
{
|
||||
try {
|
||||
// Generate PDF inside the job — never pass binary blobs through queue payload
|
||||
$invoicePdf = null;
|
||||
$invoice = null;
|
||||
$invoicePdf = null;
|
||||
$invoicePdfFileName = null;
|
||||
|
||||
if ($this->invoiceId) {
|
||||
@@ -55,7 +59,17 @@ class SendInformationVirtualMachine implements ShouldQueue
|
||||
}
|
||||
}
|
||||
|
||||
$email = new CreateVirtualMachine(2, $this->data, $invoicePdf, $invoicePdfFileName);
|
||||
// Try block-based DB template first
|
||||
$dbTemplate = EmailNotificationTemplate::where('type', 'vm_credentials')
|
||||
->where('is_active', true)
|
||||
->first();
|
||||
|
||||
if ($dbTemplate) {
|
||||
$email = new VmCredentialsMail($dbTemplate, $this->data, $invoice, $invoicePdf, $invoicePdfFileName);
|
||||
} else {
|
||||
// Fallback: legacy Template model (ID=2)
|
||||
$email = new CreateVirtualMachine(2, $this->data, $invoicePdf, $invoicePdfFileName);
|
||||
}
|
||||
|
||||
Mail::to($this->customer->email)->send($email);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user