fix check if IP is already in used in this team

This commit is contained in:
peaklabs-dev
2024-11-14 17:48:35 +01:00
parent ca4b91c51f
commit 465dfbdf53

View File

@@ -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;