| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace ModulesGarden\ProxmoxAddon\App\Jobs\Vps\NetworkRate;
- use ModulesGarden\ProxmoxAddon\App\Jobs\Vps\BaseJob;
- use ModulesGarden\ProxmoxAddon\App\Services\Vps\ProductService;
- class MinimumVmRateJob extends BaseJob
- {
- use ProductService;
- public function handle($text = null)
- {
- $this->initParams();
- $this->initServices();
- $container = [];
- $rate = $this->configuration()->getMinimumRate();
- foreach ($this->vm()->getNetworkDevices($this->configuration()->getBridge()) as $entity)
- {
- $hash = $entity->getHashCode();
- if ($entity->getRate() != $rate)
- {
- $entity->setRate($rate);
- }
- if ($hash != $entity->getHashCode())
- {
- $container[$entity->getId()] = $entity->asConfig();
- }
- }
- if (!empty($container))
- {
- $this->vm()->updateConfig($container);
- }
- }
- }
|