equal
deleted
inserted
replaced
24 * @return Response |
24 * @return Response |
25 */ |
25 */ |
26 public function index() |
26 public function index() |
27 { |
27 { |
28 $paginator = $this->documentRepository->paginateAll(); |
28 $paginator = $this->documentRepository->paginateAll(); |
29 $res = []; |
29 $res = $paginator->toArray(); |
30 foreach ($paginator->toArray() as $key => $value) { |
30 if(array_key_exists('data', $res)) { |
31 $res[($key === 'data')?'documents':$key] = $value; |
31 $documents = $res['data']; |
|
32 unset($res['data']); |
|
33 $res['documents'] = $this->documentRepository->resolveLexvo($documents); |
32 } |
34 } |
33 return response()->json($res); |
35 return response()->json($res); |
34 } |
36 } |
35 |
37 |
36 /** |
38 /** |
61 * @return Response |
63 * @return Response |
62 */ |
64 */ |
63 public function show($id) |
65 public function show($id) |
64 { |
66 { |
65 $doc = $this->documentRepository->get($id); |
67 $doc = $this->documentRepository->get($id); |
|
68 $this->documentRepository->resolveLexvo([$doc,]); |
66 if(is_null($doc)) { |
69 if(is_null($doc)) { |
67 abort(404); |
70 abort(404); |
68 } |
71 } |
69 return response()->json(["document" => $doc]); |
72 return response()->json(["document" => $doc]); |
70 } |
73 } |