Skip to content

Commit 67a491f

Browse files
authored
Update WebmanResponseTrait.php
1 parent c361300 commit 67a491f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Traits/WebmanResponseTrait.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ public static function string2utf8($string = '')
2525

2626
return $string;
2727
}
28+
29+
public function paginate(\Illuminate\Pagination\LengthAwarePaginator $paginate)
30+
{
31+
return $this->success([
32+
'meta' => [
33+
'total' => $paginate->total(),
34+
'current_page' => $paginate->currentPage(),
35+
'per_page' => $paginate->perPage(),
36+
],
37+
'data' => $paginate->items(),
38+
]);
39+
}
2840

2941
public function success($data = [], $err_msg = 'success', $err_code = 200, $headers = [])
3042
{

0 commit comments

Comments
 (0)