From b5c784daecf4758a6ba4c77120470cabca92cb2e Mon Sep 17 00:00:00 2001 From: Luca Date: Fri, 13 Nov 2020 18:39:48 +0100 Subject: [PATCH] Fix API 'total-count' e 'pages' con page > 1 --- modules/anagrafiche/src/API/v1/Anagrafiche.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/anagrafiche/src/API/v1/Anagrafiche.php b/modules/anagrafiche/src/API/v1/Anagrafiche.php index 0a0f954cb..f82b859e1 100755 --- a/modules/anagrafiche/src/API/v1/Anagrafiche.php +++ b/modules/anagrafiche/src/API/v1/Anagrafiche.php @@ -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, ]; }