Add SnapshotActionMail class and email template for snapshot actions; implement email notifications for create, remove, and revert actions

This commit is contained in:
baodev0
2026-07-17 10:17:52 +07:00
parent abc12b71ef
commit d9da3b5bb3
6 changed files with 353 additions and 21 deletions
@@ -5,6 +5,7 @@ namespace App\Jobs\VirtualMachine\Snapshot;
use App\Events\NotificationStatus;
use App\Http\Services\Telegram;
use App\Http\Services\vCenter as ServiceVCenter;
use App\Mail\Customer\SnapshotActionMail;
use App\Models\ModuleSnapshot;
use App\Models\ModuleSnapshotLimit;
use App\Models\ModuleVmware;
@@ -14,6 +15,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
class RemoveSnapshot implements ShouldQueue
{
@@ -117,6 +119,17 @@ class RemoveSnapshot implements ShouldQueue
// Send success notification
Event(new NotificationStatus("Xóa snapshot thành công cho VPS {$product->name}", true));
$product->loadMissing('customer');
if ($product->customer?->email) {
Mail::to($product->customer->email)->queue(new SnapshotActionMail([
'action' => 'remove',
'fullname' => $product->customer->fullname,
'vm_name' => $product->name,
'snapshot_name' => $snapshotName,
'action_at' => now()->format('d/m/Y H:i:s'),
]));
}
// Send Telegram notification
$this->telegram->SendMessage(
"🗑️ <b>SNAPSHOT REMOVED SUCCESSFULLY</b>\n\n" .