Skip to content

Commit

Permalink
Method paginatedList now take a third parameter of custom meta
Browse files Browse the repository at this point in the history
  • Loading branch information
ezra-obiwale committed Jan 24, 2018
1 parent e83d1e4 commit 485bf76
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Controllers/Traits/Respond.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ protected function error($message, $errors = null, $code = 400)
* @param integer $code
* @return void
*/
protected function paginatedList(array $items, $code = 200) {
protected function paginatedList(array $items, $code = 200, array $meta = []) {
$resp['data'] = array_key_exists('data', $items) ? $items['data'] : $items;
if (request()->query('length') != 'all' && count($resp['data'])) {
unset($items['data']);
$meta['pagination'] = $items;
$resp['meta']['pagination'] = $items;
$resp['meta'] = $meta;
}
return $this->success($resp, $code);
}
Expand Down

0 comments on commit 485bf76

Please sign in to comment.