|
|
@@ -82,9 +82,17 @@ class BackflowService extends BaseService
|
|
|
$query1->where('username', $username);
|
|
|
});
|
|
|
}
|
|
|
- $count = $query->count();
|
|
|
- $query->with(['user'])->orderByDesc('date')->orderBy('status');
|
|
|
- $list = $query->forPage($search['page'], $search['limit'])->get()->toArray();
|
|
|
- return ['total' => $count, 'data' => $list];
|
|
|
+
|
|
|
+ $paginator = $query
|
|
|
+ ->with(['user'])->orderByDesc('date')->orderBy('status')
|
|
|
+
|
|
|
+
|
|
|
+ ->paginate($search['limit']);
|
|
|
+
|
|
|
+// $count = $query->count();
|
|
|
+// $query->with(['user'])->orderByDesc('date')->orderBy('status');
|
|
|
+// $list = $query->forPage($search['page'], $search['limit'])->get()->toArray();
|
|
|
+// return ['total' => $count, 'data' => $list];
|
|
|
+ return ['total' => $paginator->total(), 'data' => $paginator->items()];
|
|
|
}
|
|
|
}
|