Explorar o código

fix: server name repeat

tokumeikoi %!s(int64=4) %!d(string=hai) anos
pai
achega
326fb5d918
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  1. 3 3
      app/Services/ServerService.php

+ 3 - 3
app/Services/ServerService.php

@@ -360,13 +360,13 @@ class ServerService
 
     public function serverIsExist($name):bool
     {
-        if (ServerShadowsocks::where('name', $name)->first()) {
+        if (ServerShadowsocks::where('name', $name)->count() > 0) {
             return true;
         }
-        if (ServerTrojan::where('name', $name)->first()) {
+        if (ServerTrojan::where('name', $name)->count() > 0) {
             return true;
         }
-        if (Server::where('name', $name)->first()) {
+        if (Server::where('name', $name)->count() > 0) {
             return true;
         }
         return false;