AVMG20 3 years ago
parent
commit
27028c9711
2 changed files with 8 additions and 5 deletions
  1. 1 0
      .env.example
  2. 7 5
      app/Http/Controllers/Api/UserController.php

+ 1 - 0
.env.example

@@ -3,6 +3,7 @@ APP_ENV=production
 APP_KEY=
 APP_KEY=
 APP_DEBUG=false
 APP_DEBUG=false
 APP_URL=http://localhost
 APP_URL=http://localhost
+#list with timezones https://www.php.net/manual/en/timezones.php
 APP_TIMEZONE=UTC
 APP_TIMEZONE=UTC
 
 
 DB_CONNECTION=mysql
 DB_CONNECTION=mysql

+ 7 - 5
app/Http/Controllers/Api/UserController.php

@@ -66,10 +66,11 @@ class UserController extends Controller
 
 
     /**
     /**
      * increments the users credits or/and server_limit
      * increments the users credits or/and server_limit
-     * 
+     *
      * @param Request $request
      * @param Request $request
      * @param int $id
      * @param int $id
      * @return User
      * @return User
+     * @throws ValidationException
      */
      */
     public function increment(Request $request, int $id)
     public function increment(Request $request, int $id)
     {
     {
@@ -80,7 +81,7 @@ class UserController extends Controller
             "credits"      => "sometimes|numeric|min:0|max:1000000",
             "credits"      => "sometimes|numeric|min:0|max:1000000",
             "server_limit" => "sometimes|numeric|min:0|max:1000000",
             "server_limit" => "sometimes|numeric|min:0|max:1000000",
         ]);
         ]);
-        
+
         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 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"
@@ -100,10 +101,11 @@ class UserController extends Controller
 
 
     /**
     /**
      * decrements the users credits or/and server_limit
      * decrements the users credits or/and server_limit
-     * 
+     *
      * @param Request $request
      * @param Request $request
      * @param int $id
      * @param int $id
      * @return User
      * @return User
+     * @throws ValidationException
      */
      */
     public function decrement(Request $request, int $id)
     public function decrement(Request $request, int $id)
     {
     {
@@ -114,7 +116,7 @@ class UserController extends Controller
             "credits"      => "sometimes|numeric|min:0|max:1000000",
             "credits"      => "sometimes|numeric|min:0|max:1000000",
             "server_limit" => "sometimes|numeric|min:0|max:1000000",
             "server_limit" => "sometimes|numeric|min:0|max:1000000",
         ]);
         ]);
-        
+
         if($request->credits){
         if($request->credits){
             if($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"
@@ -136,7 +138,7 @@ class UserController extends Controller
      * Remove the specified resource from storage.
      * Remove the specified resource from storage.
      *
      *
      * @param int $id
      * @param int $id
-     * @return Application|ResponseFactory|Response|void
+     * @return Application|Response|ResponseFactory
      */
      */
     public function destroy(int $id)
     public function destroy(int $id)
     {
     {