Example #1
0
 public function editComment($id)
 {
     $status = $this->input->get('status', 'publish');
     if ($status == 'draft') {
         $this->template->set('sidebar_active', 'comment_draft');
     }
     $repository = new CourseRepository($id);
     $course = $repository->get();
     $comments = collect([]);
     foreach ($course->chapters as $chapter) {
         $chapter_comments = $status == 'publish' ? $chapter->comments : $chapter->comments()->onlyDrafts()->get();
         foreach ($chapter_comments as $comment) {
             $comments->push($comment);
         }
     }
     $comments = pagination($comments, 15, 'course/edit/' . $course->id . '/comment');
     $comments->appends(compact('status'));
     $this->template->build('course/comment_list_chapter', compact('comments'));
 }