|
@@ -10,6 +10,7 @@ use Illuminate\Contracts\Routing\ResponseFactory;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Response;
|
|
use Illuminate\Http\Response;
|
|
use Illuminate\Validation\Rule;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
+use Illuminate\Validation\ValidationException;
|
|
|
|
|
|
class UserController extends Controller
|
|
class UserController extends Controller
|
|
{
|
|
{
|
|
@@ -116,7 +117,10 @@ class UserController extends Controller
|
|
|
|
|
|
if($request->credits){
|
|
if($request->credits){
|
|
if ($user->credits - $request->credits >= 99999999) throw ValidationException::withMessages([
|
|
if ($user->credits - $request->credits >= 99999999) throw ValidationException::withMessages([
|
|
- 'credits' => "You cannot remove this amount of credits because you would exceed the minimum credit"
|
|
|
|
|
|
+ '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([
|
|
|
|
+ '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);
|
|
}
|
|
}
|
|
@@ -125,6 +129,9 @@ class UserController extends Controller
|
|
if ($user->server_limit - $request->server_limit >= 2147483647) throw ValidationException::withMessages([
|
|
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."
|
|
'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([
|
|
|
|
+ '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);
|
|
}
|
|
}
|
|
|
|
|