Ken hai 2 meses
pai
achega
5369230fed
Modificáronse 2 ficheiros con 10 adicións e 0 borrados
  1. 1 0
      app/Http/Controllers/admin/Bet.php
  2. 9 0
      app/Services/BetService.php

+ 1 - 0
app/Http/Controllers/admin/Bet.php

@@ -34,6 +34,7 @@ class Bet extends Controller
                 'username' => ['nullable', 'string', 'min:1'],
                 'start_time' => ['nullable', 'date', 'date_format:Y-m-d', 'required_with:end_time'],
                 'end_time' => ['nullable', 'date', 'date_format:Y-m-d', 'required_with:start_time'],
+                'is_winner'=>['nullable','integer','in:0,1'],
 
             ]);
             $result = BetService::paginate($params);

+ 9 - 0
app/Services/BetService.php

@@ -79,6 +79,15 @@ class BetService extends BaseService
             $where[] = ['created_at', '<=', "{$search['end_time']} 23:59:59"];
         }
 
+        if (isset($search['is_winner']) && !empty($search['is_winner'])) {
+            $where[] = ['status', '=', 1];
+            if ($search['is_winner'] == 1) {
+                $where[] = ['profit', '>', 0];
+            } else {
+                $where[] = ['profit', '<=', 0];
+            }
+        }
+
 
         return $where;
     }