Add SnapshotActionMail class and email template for snapshot actions; implement email notifications for create, remove, and revert actions
This commit is contained in:
@@ -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" .
|
||||
|
||||
Reference in New Issue
Block a user