From 465dfbdf530bc7b09e62344ca435a5b1189a2eb6 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Thu, 14 Nov 2024 17:48:35 +0100 Subject: [PATCH] fix check if IP is already in used in this team --- app/Livewire/Server/Show.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Livewire/Server/Show.php b/app/Livewire/Server/Show.php index 5a1743f96..a5544489d 100644 --- a/app/Livewire/Server/Show.php +++ b/app/Livewire/Server/Show.php @@ -107,6 +107,15 @@ class Show extends Component { if ($toModel) { $this->validate(); + + if (Server::where('team_id', currentTeam()->id) + ->where('ip', $this->ip) + ->where('id', '!=', $this->server->id) + ->exists()) { + $this->ip = $this->server->ip; + throw new \Exception('This IP/Domain is already in use by another server in your team.'); + } + $this->server->name = $this->name; $this->server->description = $this->description; $this->server->ip = $this->ip;