diff -r 47f0611cc57d -r 92fc9d077f95 server/src/app/Http/Controllers/Api/DocumentController.php --- a/server/src/app/Http/Controllers/Api/DocumentController.php Thu Oct 06 16:45:37 2016 +0200 +++ b/server/src/app/Http/Controllers/Api/DocumentController.php Fri Oct 07 02:07:34 2016 +0200 @@ -25,17 +25,18 @@ * * @return Response */ - public function index() + public function index(Request $request) { - $paginator = $this->documentRepository->paginateAll(); + $perPage = intval($request->input('perpage', config('corpusparole.documents_per_page'))); + $paginator = $this->documentRepository->paginateAll($perPage); $res = $paginator->toArray(); if(array_key_exists('data', $res)) { $documents = $res['data']; unset($res['data']); - $res['documents'] = $documents; - //$res['documents'] = $this->documentRepository->resolveLexvo($documents); + } else { + $documents = []; } - return response()->json($res); + return response()->json([ 'documents' => $documents, 'meta' => $res]); } /**