From 949407368e6da4ae9f7c36629234280e8d14a932 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 14 Sep 2023 18:10:13 +0200 Subject: [PATCH] fix: uniqueips --- app/Http/Livewire/Server/Form.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Http/Livewire/Server/Form.php b/app/Http/Livewire/Server/Form.php index 5bf298c31..184c59704 100644 --- a/app/Http/Livewire/Server/Form.php +++ b/app/Http/Livewire/Server/Form.php @@ -88,7 +88,13 @@ class Form extends Component public function submit() { $this->validate(); - + $uniqueIPs = Server::all()->reject(function (Server $server) { + return $server->id === $this->server->id; + })->pluck('ip')->toArray(); + if (in_array($this->server->ip, $uniqueIPs)) { + $this->emit('error', 'IP address is already in use by another team.'); + return; + } $this->server->settings->wildcard_domain = $this->wildcard_domain; $this->server->settings->cleanup_after_percentage = $this->cleanup_after_percentage; $this->server->settings->save();