Ken пре 1 недеља
родитељ
комит
1e58a75338
1 измењених фајлова са 13 додато и 7 уклоњено
  1. 13 7
      app/Http/Controllers/admin/Withdraw.php

+ 13 - 7
app/Http/Controllers/admin/Withdraw.php

@@ -61,13 +61,19 @@ class Withdraw extends Controller
 
             $totalAmount = (float)$query->where($where)
                 ->whereDate('created_at', date('Y-m-d'))->sum('amount');
-           $totalSuccess = (float)$query->where($where)->whereDate('created_at', date('Y-m-d'))
-                ->whereIn('status', [1,2])->sum('amount');
-
-
-
-
-            $result = ['totalSuccess'=>$totalSuccess,'total_amount' => $totalAmount, 'total' => $count, 'data' => $list];
+            $totalSuccess = (float)$query->where($where)->whereDate('created_at', date('Y-m-d'))
+                ->whereIn('status', [1, 2])->sum('amount');
+            $totalFail = (float)$query->where($where)->whereDate('created_at', date('Y-m-d'))
+                ->where('status', 3)->sum('amount');
+
+
+            $result = [
+                'totalFail' => $totalFail,
+                'totalSuccess' => $totalSuccess,
+                'total_amount' => $totalAmount,
+                'total' => $count,
+                'data' => $list
+            ];
         } catch (ValidationException $e) {
             return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first());
         } catch (Exception $e) {