equal
deleted
inserted
replaced
22 * |
22 * |
23 * @return Response |
23 * @return Response |
24 */ |
24 */ |
25 public function index() |
25 public function index() |
26 { |
26 { |
27 return response()->json($this->documentRepository->paginateAll()); |
27 $paginator = $this->documentRepository->paginateAll(); |
|
28 $res = []; |
|
29 foreach ($paginator->toArray() as $key => $value) { |
|
30 $res[($key === 'data')?'documents':$key] = $value; |
|
31 } |
|
32 return response()->json($res); |
28 } |
33 } |
29 |
34 |
30 /** |
35 /** |
31 * Show the form for creating a new resource. |
36 * Show the form for creating a new resource. |
32 * |
37 * |
58 { |
63 { |
59 $doc = $this->documentRepository->get($id); |
64 $doc = $this->documentRepository->get($id); |
60 if(is_null($doc)) { |
65 if(is_null($doc)) { |
61 abort(404); |
66 abort(404); |
62 } |
67 } |
63 return response()->json($doc); |
68 return response()->json(["document" => $doc]); |
64 } |
69 } |
65 |
70 |
66 /** |
71 /** |
67 * Show the form for editing the specified resource. |
72 * Show the form for editing the specified resource. |
68 * |
73 * |