equal
deleted
inserted
replaced
23 /** |
23 /** |
24 * Display a listing of the resource. |
24 * Display a listing of the resource. |
25 * |
25 * |
26 * @return Response |
26 * @return Response |
27 */ |
27 */ |
28 public function index() |
28 public function index(Request $request) |
29 { |
29 { |
30 $paginator = $this->documentRepository->paginateAll(); |
30 $perPage = intval($request->input('perpage', config('corpusparole.documents_per_page'))); |
|
31 $paginator = $this->documentRepository->paginateAll($perPage); |
31 $res = $paginator->toArray(); |
32 $res = $paginator->toArray(); |
32 if(array_key_exists('data', $res)) { |
33 if(array_key_exists('data', $res)) { |
33 $documents = $res['data']; |
34 $documents = $res['data']; |
34 unset($res['data']); |
35 unset($res['data']); |
35 $res['documents'] = $documents; |
36 } else { |
36 //$res['documents'] = $this->documentRepository->resolveLexvo($documents); |
37 $documents = []; |
37 } |
38 } |
38 return response()->json($res); |
39 return response()->json([ 'documents' => $documents, 'meta' => $res]); |
39 } |
40 } |
40 |
41 |
41 /** |
42 /** |
42 * Show the form for creating a new resource. |
43 * Show the form for creating a new resource. |
43 * |
44 * |