From c365d132af282fd89597519ac98e2115c57fc791 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 8 Nov 2023 09:30:38 +0100 Subject: [PATCH] Fix empty public port in database configuration --- app/Http/Livewire/Project/Database/Mariadb/General.php | 3 +++ app/Http/Livewire/Project/Database/Mongodb/General.php | 7 +++++-- app/Http/Livewire/Project/Database/Mysql/General.php | 3 +++ app/Http/Livewire/Project/Database/Postgresql/General.php | 4 +++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/Http/Livewire/Project/Database/Mariadb/General.php b/app/Http/Livewire/Project/Database/Mariadb/General.php index 4d04371d0..11b5fc42b 100644 --- a/app/Http/Livewire/Project/Database/Mariadb/General.php +++ b/app/Http/Livewire/Project/Database/Mariadb/General.php @@ -44,6 +44,9 @@ class General extends Component public function submit() { try { + if (str($this->database->public_port)->isEmpty()) { + $this->database->public_port = null; + } $this->validate(); $this->database->save(); $this->emit('success', 'Database updated successfully.'); diff --git a/app/Http/Livewire/Project/Database/Mongodb/General.php b/app/Http/Livewire/Project/Database/Mongodb/General.php index 2e6bed4a4..ce0ff14ea 100644 --- a/app/Http/Livewire/Project/Database/Mongodb/General.php +++ b/app/Http/Livewire/Project/Database/Mongodb/General.php @@ -42,10 +42,13 @@ class General extends Component public function submit() { try { - $this->validate(); - if ($this->database->mongo_conf === "") { + if (str($this->database->public_port)->isEmpty()) { + $this->database->public_port = null; + } + if (str($this->database->mongo_conf)->isEmpty()) { $this->database->mongo_conf = null; } + $this->validate(); $this->database->save(); $this->emit('success', 'Database updated successfully.'); } catch (Exception $e) { diff --git a/app/Http/Livewire/Project/Database/Mysql/General.php b/app/Http/Livewire/Project/Database/Mysql/General.php index ca7eb6ebe..416970ea9 100644 --- a/app/Http/Livewire/Project/Database/Mysql/General.php +++ b/app/Http/Livewire/Project/Database/Mysql/General.php @@ -44,6 +44,9 @@ class General extends Component public function submit() { try { + if (str($this->database->public_port)->isEmpty()) { + $this->database->public_port = null; + } $this->validate(); $this->database->save(); $this->emit('success', 'Database updated successfully.'); diff --git a/app/Http/Livewire/Project/Database/Postgresql/General.php b/app/Http/Livewire/Project/Database/Postgresql/General.php index 4e3bda418..7872764e3 100644 --- a/app/Http/Livewire/Project/Database/Postgresql/General.php +++ b/app/Http/Livewire/Project/Database/Postgresql/General.php @@ -91,7 +91,6 @@ class General extends Component $collection = collect($this->database->init_scripts); $found = $collection->firstWhere('filename', $script['filename']); if ($found) { - ray($collection->filter(fn ($s) => $s['filename'] !== $script['filename'])->toArray()); $this->database->init_scripts = $collection->filter(fn ($s) => $s['filename'] !== $script['filename'])->toArray(); $this->database->save(); $this->refresh(); @@ -135,6 +134,9 @@ class General extends Component public function submit() { try { + if (str($this->database->public_port)->isEmpty()) { + $this->database->public_port = null; + } $this->validate(); $this->database->save(); $this->emit('success', 'Database updated successfully.');