Beispiel #1
0
 public function getCommentsByIdArticle($id)
 {
     return Cache::store($this->store)->rememberForever($id, function () use($id) {
         $data = [];
         $comments_model = new CommentsModel();
         $comments = $comments_model->published()->commentsByArticleId($id)->orderByParam()->get();
         foreach ($comments as $coment) {
             $data[] = ['id' => $coment->id, 'user' => $coment->user, 'message' => $coment->message, 'answer' => $coment->answer];
         }
         return $data;
     });
 }