load->model( $models ); $this->load->library( $libraries ); } public function index() { } public function getComments( $foreignID, $tablename ) { $comments = Comment::getComments( $foreignID, $tablename ); $this->json( $comments ); } public function getComment( $commentID ) { $comment = Comment::find( $commentID ); $comment->comment = base64_decode( $comment->comment ); $this->json( $comment ); } public function addComment( $foreignID, $tablename ) { $commentID = Comment::addComment( $foreignID, $tablename ); $this->json( $commentID ); } public function saveComment( $commentID ) { $comment = $this->input->post( 'comment' ); $comment = base64_encode( $comment ); Comment::whereId( $commentID )->update( ['comment' => $comment] ); } }