equal
deleted
inserted
replaced
63 * Display the specified resource. |
63 * Display the specified resource. |
64 * |
64 * |
65 * @param string $id |
65 * @param string $id |
66 * @return Response |
66 * @return Response |
67 */ |
67 */ |
68 public function show($id) |
68 public function show(Request $request, $id) |
69 { |
69 { |
70 $doc = $this->documentRepository->get($id); |
70 $short = filter_var($request->input('short', false), FILTER_VALIDATE_BOOLEAN); |
|
71 $doc = $this->documentRepository->get($id, $short); |
71 if(is_null($doc)) { |
72 if(is_null($doc)) { |
72 abort(404); |
73 abort(404); |
73 } |
74 } |
74 //$this->documentRepository->resolveLexvo([$doc,]); |
75 //$this->documentRepository->resolveLexvo([$doc,]); |
75 return response()->json(["document" => $doc]); |
76 return response()->json(["document" => $doc]); |
84 public function transcript($id) { |
85 public function transcript($id) { |
85 $doc = $this->documentRepository->get($id); |
86 $doc = $this->documentRepository->get($id); |
86 if(is_null($doc) || is_null($doc->getTranscript()) ) { |
87 if(is_null($doc) || is_null($doc->getTranscript()) ) { |
87 abort(404); |
88 abort(404); |
88 } |
89 } |
89 $transcriptDef = $doc->getTranscript(); |
90 $transcript = $doc->getTranscript(); |
90 |
91 $transcriptUrl = $transcript->getUrl(); |
91 $transcriptUrl = $transcriptDef['url']; |
92 if(empty($transcriptUrl) || empty($transcript->getConformsTo())) { |
92 if(empty($transcriptUrl) || empty($transcriptDef['conforms-to'])) { |
|
93 abort(404); |
93 abort(404); |
94 } |
94 } |
95 $converter = $this->transcriptManager->getConverterUrl($transcriptDef['conforms-to'], $doc, $transcriptUrl); |
95 $converter = $this->transcriptManager->getConverterUrl($transcript->getConformsTo(), $doc, $transcriptUrl); |
96 return response()->json($converter->convertToJson()); |
96 return response()->json($converter->convertToJson()); |
97 |
97 |
98 } |
98 } |
99 |
99 |
100 /** |
100 /** |