Ken 2 هفته پیش
والد
کامیت
2d3205c93f
1فایلهای تغییر یافته به همراه6 افزوده شده و 6 حذف شده
  1. 6 6
      app/Http/Controllers/admin/Bet.php

+ 6 - 6
app/Http/Controllers/admin/Bet.php

@@ -15,7 +15,7 @@ class Bet extends Controller
 
     function index()
     {
-//        try {
+        try {
         $params = request()->validate([
             'page' => ['nullable', 'integer', 'min:1'],
             'limit' => ['nullable', 'integer', 'min:1'],
@@ -59,11 +59,11 @@ class Bet extends Controller
                 $item['is_winner'] = $item['profit'] > 0;
             }
         }
-//        } catch (ValidationException $e) {
-//            return $this->error(HttpStatus::VALIDATION_FAILED, $e->validator->errors()->first());
-//        } catch (Exception $e) {
-//            return $this->error(intval($e->getCode()));
-//        }
+        } catch (ValidationException $e) {
+            return $this->error(HttpStatus::VALIDATION_FAILED, $e->validator->errors()->first());
+        } catch (Exception $e) {
+            return $this->error(HttpStatus::CUSTOM_ERROR, $e->getMessage());
+        }
         return $this->success($result);
     }