Fix API 'total-count' e 'pages' con page > 1

This commit is contained in:
Luca 2020-11-13 18:39:48 +01:00
parent 1baa8a8ed3
commit b5c784daec
1 changed files with 3 additions and 1 deletions

View File

@ -93,11 +93,13 @@ class Anagrafiche extends Resource implements RetrieveInterface, CreateInterface
$query = $query->havingRaw($having);
}
$total_count = $query->count();
return [
'results' => $query->skip($request['page'] * $request['length'])
->limit($request['length'])
->get()->toArray(),
'total-count' => $query->count(),
'total-count' => $total_count,
];
}