feat: enhance max allowed storage loading by integrating ExtensionHelper for improved settings management
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Paymenter\Extensions\Servers\Proxmox\Livewire;
|
||||
|
||||
use App\Helpers\ExtensionHelper;
|
||||
use Illuminate\Support\Str;
|
||||
use Livewire\Attributes\Locked;
|
||||
use Paymenter\Extensions\Servers\Proxmox\Models\Server;
|
||||
@@ -123,14 +124,17 @@ class Storage extends Component
|
||||
|
||||
/**
|
||||
* Load the maximum allowed storage from the plan configuration.
|
||||
* Uses ExtensionHelper to merge product settings with service properties,
|
||||
* ensuring upgraded disk sizes are properly reflected.
|
||||
*/
|
||||
protected function loadMaxAllowedStorage(): void
|
||||
{
|
||||
$diskSetting = $this->server->service->product->settings()
|
||||
->where('key', 'disk')
|
||||
->first();
|
||||
$settings = array_merge(
|
||||
ExtensionHelper::settingsToArray($this->server->service->product->settings),
|
||||
ExtensionHelper::getServiceProperties($this->server->service)
|
||||
);
|
||||
|
||||
$this->maxAllowedStorage = $diskSetting ? (float) $diskSetting->value : 0;
|
||||
$this->maxAllowedStorage = isset($settings['disk']) ? (float) $settings['disk'] : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user