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
@@ -267,4 +267,74 @@ PS;
return $data;
}
public function changeIpVM(
string $vmName,
string $vmwareId,
string $ipAddress,
string $gateway,
string $osType,
string $guestUser = '',
string $guestPassword = '',
string $dns = '8.8.8.8',
string $hostname = ''
): string {
$q = fn(string $v) => str_replace("'", "''", $v);
$isLinux = str_contains(strtolower($osType), 'linux')
|| str_contains(strtolower($osType), 'ubuntu')
|| str_contains(strtolower($osType), 'centos')
|| str_contains(strtolower($osType), 'rocky');
if ($isLinux) {
$psFile = "C:\\CLISave\\changeIPLinux.ps1";
$Command = "& '{$psFile}'"
. " -VMName '" . $q($vmName) . "'"
. " -IP '" . $q($ipAddress) . "'"
. " -Gateway '" . $q($gateway) . "'"
. " -DNS '" . $q($dns) . "'"
. " -GuestUser '" . $q($guestUser) . "'"
. " -GuestPassword '" . $q($guestPassword) . "'";
Log::channel('Custom')->info('[changeIpVM:linux] ' . $Command);
return (string) $this->CommandChangePort($Command, true);
}
$VirtualMachine = "VirtualMachine-$vmwareId";
$hn = strtolower($hostname ?: $vmName);
$Command = "\$vm = get-vm -Id '{$VirtualMachine}';"
. " \$hostname = '{$q($hn)}';"
. " \$ipadd = '{$q($ipAddress)}';"
. " \$gw = '{$q($gateway)}';"
. " \$password = \"'{$q($guestPassword)}'\"; "
. " cd /; C:\\CLISave\\changeWindows1line.ps1;";
Log::channel('Custom')->info('[changeIpVM:windows] ' . $Command);
return (string) $this->CommandRSP($Command);
}
public function getWindowsRdpPort(string $vmwareId, string $guestUser, string $guestPassword): ?int
{
$ps = "(Get-ItemProperty 'HKLM:\\System\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp' -Name PortNumber).PortNumber";
$cmd = "Invoke-VMScript -VM '$vmwareId' "
. "-ScriptText \"$ps\" "
. "-ScriptType Powershell "
. "-GuestUser '$guestUser' "
. "-GuestPassword '$guestPassword'";
$output = $this->CommandRSP($cmd);
if (!$output || str_contains($output, 'Login_Fail')) {
return null;
}
if (preg_match('/\b(\d{2,5})\b/', $output, $m)) {
return (int) $m[1];
}
return null;
}
}