Exemplo n.º 1
0
 public function index_onShow()
 {
     if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
         foreach ($checkedIds as $id) {
             if (!($comment = Comment::find($id))) {
                 continue;
             }
             $comment->published = 1;
             $comment->save();
             $helper = new Helper();
             $comments = $helper->getChildren($id);
             DB::table('xeor_comments_comments')->whereIn('id', $comments)->update(array('published' => 1));
         }
         Flash::success('Successfully show those comments.');
     }
     return $this->listRefresh();
 }
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;
 }