diff --git a/app/Livewire/Project/New/Select.php b/app/Livewire/Project/New/Select.php index 849150222..c56290a06 100644 --- a/app/Livewire/Project/New/Select.php +++ b/app/Livewire/Project/New/Select.php @@ -15,10 +15,10 @@ class Select extends Component public string $type; public string $server_id; public string $destination_uuid; - public Countable|array|Server $allServers = []; - public Countable|array|Server $servers = []; - public Collection|array $standaloneDockers = []; - public Collection|array $swarmDockers = []; + public Collection|null|Server $allServers; + public Collection|null|Server $servers; + public ?Collection $standaloneDockers; + public ?Collection $swarmDockers; public array $parameters; public Collection|array $services = []; public Collection|array $allServices = []; @@ -107,7 +107,11 @@ public function instantSave() if ($this->includeSwarm) { $this->servers = $this->allServers; } else { - $this->servers = $this->allServers->where('settings.is_swarm_worker', false)->where('settings.is_swarm_manager', false)->where('settings.is_build_server', false); + if ($this->allServers instanceof Collection) { + $this->servers = $this->allServers->where('settings.is_swarm_worker', false)->where('settings.is_swarm_manager', false)->where('settings.is_build_server', false); + } else { + $this->servers = $this->allServers; + } } } public function setType(string $type) @@ -126,13 +130,21 @@ public function setType(string $type) case 'mongodb': $this->isDatabase = true; $this->includeSwarm = false; - $this->servers = $this->allServers->where('settings.is_swarm_worker', false)->where('settings.is_swarm_manager', false)->where('settings.is_build_server', false); + if ($this->allServers instanceof Collection) { + $this->servers = $this->allServers->where('settings.is_swarm_worker', false)->where('settings.is_swarm_manager', false)->where('settings.is_build_server', false); + } else { + $this->servers = $this->allServers; + } break; } if (str($type)->startsWith('one-click-service') || str($type)->startsWith('docker-compose-empty')) { $this->isDatabase = true; $this->includeSwarm = false; - $this->servers = $this->allServers->where('settings.is_swarm_worker', false)->where('settings.is_swarm_manager', false)->where('settings.is_build_server', false); + if ($this->allServers instanceof Collection) { + $this->servers = $this->allServers->where('settings.is_swarm_worker', false)->where('settings.is_swarm_manager', false)->where('settings.is_build_server', false); + } else { + $this->servers = $this->allServers; + } } if ($type === "existing-postgresql") { $this->current_step = $type;