Browse Source

Update UserController.php

António Duarte 3 years ago
parent
commit
f177ae53ce
1 changed files with 2 additions and 8 deletions
  1. 2 8
      app/Http/Controllers/Api/UserController.php

+ 2 - 8
app/Http/Controllers/Api/UserController.php

@@ -116,20 +116,14 @@ class UserController extends Controller
         ]);
         ]);
         
         
         if($request->credits){
         if($request->credits){
-             if ($user->credits - $request->credits >= 99999999) throw ValidationException::withMessages([
-                'credits' => "You cannot remove this amount of credits because you would exceed the minimum credit limit"
-            ]);
-            elseif($user->credits - $request->credits < 0) throw ValidationException::withMessages([
+            if($user->credits - $request->credits < 0) throw ValidationException::withMessages([
                 'credits' => "You can't remove this amount of credits because you would exceed the minimum credit limit"
                 'credits' => "You can't remove this amount of credits because you would exceed the minimum credit limit"
             ]);
             ]);
             $user->decrement('credits', $request->credits);
             $user->decrement('credits', $request->credits);
          }
          }
 
 
         if($request->server_limit){
         if($request->server_limit){
-            if ($user->server_limit - $request->server_limit >= 2147483647) throw ValidationException::withMessages([
-                'server_limit' => "You cannot remove this amount of servers because it would exceed the minimum server."
-            ]);
-            elseif($user->server_limit - $request->server_limit < 0) throw ValidationException::withMessages([
+            if($user->server_limit - $request->server_limit < 0) throw ValidationException::withMessages([
                 'server_limit' => "You cannot remove this amount of servers because it would exceed the minimum server."
                 'server_limit' => "You cannot remove this amount of servers because it would exceed the minimum server."
             ]);
             ]);
            $user->decrement('server_limit', $request->server_limit);
            $user->decrement('server_limit', $request->server_limit);