diff --git a/.env.example b/.env.example index 2c3c21aa..c9562f96 100644 --- a/.env.example +++ b/.env.example @@ -3,6 +3,7 @@ APP_ENV=production APP_KEY= APP_DEBUG=false APP_URL=http://localhost +#list with timezones https://www.php.net/manual/en/timezones.php APP_TIMEZONE=UTC DB_CONNECTION=mysql diff --git a/app/Http/Controllers/Api/UserController.php b/app/Http/Controllers/Api/UserController.php index 5a21945d..126a55b7 100644 --- a/app/Http/Controllers/Api/UserController.php +++ b/app/Http/Controllers/Api/UserController.php @@ -66,10 +66,11 @@ class UserController extends Controller /** * increments the users credits or/and server_limit - * + * * @param Request $request * @param int $id * @return User + * @throws ValidationException */ public function increment(Request $request, int $id) { @@ -80,7 +81,7 @@ class UserController extends Controller "credits" => "sometimes|numeric|min:0|max:1000000", "server_limit" => "sometimes|numeric|min:0|max:1000000", ]); - + if($request->credits){ 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" @@ -100,10 +101,11 @@ class UserController extends Controller /** * decrements the users credits or/and server_limit - * + * * @param Request $request * @param int $id * @return User + * @throws ValidationException */ public function decrement(Request $request, int $id) { @@ -114,7 +116,7 @@ class UserController extends Controller "credits" => "sometimes|numeric|min:0|max:1000000", "server_limit" => "sometimes|numeric|min:0|max:1000000", ]); - + if($request->credits){ 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" @@ -136,7 +138,7 @@ class UserController extends Controller * Remove the specified resource from storage. * * @param int $id - * @return Application|ResponseFactory|Response|void + * @return Application|Response|ResponseFactory */ public function destroy(int $id) {