Ejemplo n.º 1
0
 public function postComments($docId, $annotationId)
 {
     $comment = Input::get('comment');
     $annotation = Annotation::where('doc_id', '=', $docId)->where('id', '=', $annotationId)->first();
     $annotation->link = $annotation->getLink();
     $annotation->type = 'annotation';
     $result = $annotation->addOrUpdateComment($comment);
     // TODO: Hack to allow notification events.  Needs cleaned up.
     $result->doc_id = $docId;
     $result->link = $result->getLink($docId);
     Event::fire(MadisonEvent::DOC_SUBCOMMENT, array('subcomment' => $result, 'parent' => $annotation));
     return Response::json($result);
 }
Ejemplo n.º 2
0
 /**
  * @param Request $request
  * @return string
  */
 public function search(Request $request)
 {
     $annotations = Annotation::where('page_id', $request->get('page'))->get();
     return response()->json(['total' => count($annotations), 'rows' => $annotations]);
 }