Ken 5 dni temu
rodzic
commit
52024cac00
1 zmienionych plików z 2 dodań i 3 usunięć
  1. 2 3
      app/Services/BackflowService.php

+ 2 - 3
app/Services/BackflowService.php

@@ -72,8 +72,7 @@ class BackflowService extends BaseService
 
     public static function paginate(array $search = []): array
     {
-        $page = request()->input('page', 1);
-        $limit = request()->input('limit', 10);
+
         $date = Carbon::now('Asia/Shanghai')->format('Y-m');
         $query = static::$MODEL::where(static::getWhere($search))
             ->where('date', '<', $date);
@@ -85,7 +84,7 @@ class BackflowService extends BaseService
         }
         $count = $query->count();
         $query->with(['user'])->orderByDesc('date')->orderBy('status');
-        $list = $query->forPage($page, $limit)->get()->toArray();
+        $list = $query->forPage($search['page'], $search['limit'])->get()->toArray();
 
         return ['total' => $count, 'data' => $list];
     }