Add stubs for various Laravel components and scaffolding

- Created stubs for JavaScript and SASS assets.
- Added stubs for channel, command, component, controller, event, factory, job, listener, mail, middleware, migration, model, notification, observer, policy, request, resource, route provider, seeder, and validation rule.
- Implemented scaffolding for configuration, service provider, and Vite integration.
- Included example views for module structure.
- Introduced a module loader for Vite to handle asset paths dynamically.
This commit is contained in:
baodev0
2026-05-29 09:28:08 +07:00
parent fccb0c353a
commit 6bb4a47bfb
89 changed files with 3355 additions and 4560 deletions
+134 -1
View File
@@ -5,7 +5,6 @@ namespace App\Http\Services\vCenter;
use App\Support\Cache\CacheKey;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Log;
use App\Http\Facade\SignRSA;
class SnapshotService
{
@@ -291,6 +290,140 @@ class SnapshotService
return $list;
}
public function RemoveSnapShot($product, $snap = ''): string|array
{
$vcenter = $this->resolveVCenterFromProduct($product);
if (!$vcenter) {
return ['error' => true, 'message' => 'Không tìm thấy thông tin vCenter cho VM'];
}
$loginResult = $this->client->loginServer($vcenter);
if (!$loginResult) {
return "Login_Again";
}
$vmware_name = (string) $product->name;
$check = $this->client->checkApiExits();
if ($check) {
try {
Log::channel('Custom')->info("===================================================================");
Log::channel('Custom')->info("Remove Snapshot with VirtualMachine Name - $vmware_name - Snap #$snap");
Log::channel('Custom')->info("\r\n");
$Command = "& 'C:\CLISave\deletesnap.ps1' -vm_name '$vmware_name' -name '$snap'";
Log::channel('Custom')->info("$Command");
$cmdResult = $this->powerShellService->executePowerCLI($Command);
Log::channel('Custom')->info("Command Result: " . $cmdResult);
if (strpos($cmdResult, 'Login_Fail') !== false) {
return [
'error' => true,
'message' => 'SSH Login to PowerShell server failed'
];
}
if (strpos($cmdResult, '[STDERR]') !== false || stripos($cmdResult, 'error') !== false) {
return [
'error' => true,
'message' => 'PowerShell command failed: ' . $cmdResult
];
}
Log::channel('Custom')->info("\r\n");
Log::channel('Custom')->info("After run Command |" . now());
Log::channel('Custom')->info("===================================================================");
$this->clearSnapshotCache($product);
return [
'error' => false
];
} catch (\Exception $error) {
Log::channel('Custom')->info("\r\n");
Log::channel('Custom')->info("===================================================================");
Log::channel('Custom')->info("Error Log: ");
Log::channel('Custom')->info($error->getMessage());
Log::channel('Custom')->info("===================================================================");
return [
'error' => true,
'message' => $error->getMessage()
];
}
}
return "Login_Again";
}
public function RevertSnapShot($product, $snap = ''): string|array
{
$vcenter = $this->resolveVCenterFromProduct($product);
if (!$vcenter) {
return ['error' => true, 'message' => 'Không tìm thấy thông tin vCenter cho VM'];
}
$loginResult = $this->client->loginServer($vcenter);
if (!$loginResult) {
return "Login_Again";
}
$vmware_name = (string) $product->name;
$check = $this->client->checkApiExits();
if ($check) {
try {
Log::channel('Custom')->info("===================================================================");
Log::channel('Custom')->info("Revert Snapshot with VirtualMachine Name - $vmware_name - Snap #$snap");
Log::channel('Custom')->info("\r\n");
$Command = "& 'C:\CLISave\backSnap.ps1' -vm_name '$vmware_name' -name '$snap'";
Log::channel('Custom')->info("$Command");
$cmdResult = $this->powerShellService->executePowerCLI($Command);
Log::channel('Custom')->info("Command Result: " . $cmdResult);
if (strpos($cmdResult, 'Login_Fail') !== false) {
return [
'error' => true,
'message' => 'SSH Login to PowerShell server failed'
];
}
if (strpos($cmdResult, '[STDERR]') !== false || stripos($cmdResult, 'error') !== false) {
return [
'error' => true,
'message' => 'PowerShell command failed: ' . $cmdResult
];
}
Log::channel('Custom')->info("\r\n");
Log::channel('Custom')->info("After run Command |" . now());
Log::channel('Custom')->info("===================================================================");
$this->clearSnapshotCache($product);
return [
'error' => false
];
} catch (\Exception $error) {
Log::channel('Custom')->info("\r\n");
Log::channel('Custom')->info("===================================================================");
Log::channel('Custom')->info("Error Log: ");
Log::channel('Custom')->info($error->getMessage());
Log::channel('Custom')->info("===================================================================");
return [
'error' => true,
'message' => $error->getMessage()
];
}
}
return "Login_Again";
}
private function callSoap($soapBody, $cookie = null)
{
$curl = curl_init();