Exemplo n.º 1
0
 public function index()
 {
     $this->vars['total'] = Comment::count();
     $this->vars['published'] = Comment::isPublished()->count();
     $this->vars['hidden'] = $this->vars['total'] - $this->vars['published'];
     $this->asExtension('ListController')->index();
 }
Exemplo n.º 2
0
 public function loadComments($slug)
 {
     return \Xeor\Comments\Models\Comment::isPublished()->where('cid', $slug)->get();
 }
Exemplo n.º 3
0
 /**
  * @return mixed
  *
  * Get all comments
  *
  */
 protected function loadComments()
 {
     $cid = $this->property('slug');
     $comments = Comment::isPublished()->where('cid', $cid)->get();
     foreach ($comments as $key => $comment) {
         // get user
         $comment_author = self::getUser($comment->user_id);
         if ($comment_author) {
             // get user avatar
             $comments[$key]->user_avatar = $comment_author->getAvatarThumb(64);
             // Check if user name exist
             if (isset($comment_author->name)) {
                 $comments[$key]->user_name = $comment_author->name;
             } else {
                 $comments[$key]->user_name = '';
             }
         }
     }
     return $comments;
 }