Hiekki 3 years ago
parent
commit
f331049ec0
1 changed files with 2 additions and 2 deletions
  1. 2 2
      app/Http/Controllers/Api/UserController.php

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

@@ -78,8 +78,8 @@ class UserController extends Controller
         $request->validate([
         $request->validate([
             "credits"      => "required|numeric|min:0|max:1000000",
             "credits"      => "required|numeric|min:0|max:1000000",
         ]);
         ]);
-        
-        if ($request->user()->credits + $request->credits >= 99999999) throw ValidationException::withMessages([
+
+        if ($user->credits + $request->credits >= 99999999) throw ValidationException::withMessages([
             'credits' => "You can't add this amount of credits because you would exceed the credit limit"
             'credits' => "You can't add this amount of credits because you would exceed the credit limit"
         ]);
         ]);