本文整理汇总了PHP中Comments::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Comments::count方法的具体用法?PHP Comments::count怎么用?PHP Comments::count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comments
的用法示例。
在下文中一共展示了Comments::count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: templateData
public function templateData()
{
$uAuthor = ObjectCache::getByType('\\Kiki\\User', $this->userId);
$data = array('id' => $this->id, 'url' => $this->url(), 'ctime' => strtotime($this->ctime), 'relTime' => Misc::relativeTime($this->ctime), 'title' => $this->title(), 'body' => $this->body, 'author' => $uAuthor->name(), 'publications' => array(), 'likes' => $this->likes(), 'comments' => Comments::count($this->objectId), 'html' => array('comments' => Comments::show($this->objectId)));
$publications = $this->publications();
foreach ($publications as $publication) {
$data['publications'][] = $publication->templateData();
}
return $data;
}
示例2: templateData
public function templateData()
{
$uAuthor = ObjectCache::getByType('\\Kiki\\User', $this->userId);
$prevArticle = $this->getPrev();
$nextArticle = $this->getNext();
$data = array('id' => $this->id, 'url' => $this->url(), 'ctime' => strtotime($this->ctime), 'relTime' => Misc::relativeTime($this->ctime), 'title' => $this->title, 'body' => $this->body, 'author' => $uAuthor->name(), 'images' => array(), 'publications' => array(), 'likes' => $this->likes(), 'comments' => Comments::count($this->objectId), 'html' => array('comments' => Comments::show($this->objectId), 'editform' => $this->form(true, 'articles')));
if ($nextArticle = $this->getNext()) {
$data['next'] = array('id' => $nextArticle->id(), 'url' => $nextArticle->url(), 'title' => $nextArticle->title());
}
if ($prevArticle = $this->getPrev()) {
$data['prev'] = array('id' => $prevArticle->id(), 'url' => $prevArticle->url(), 'title' => $prevArticle->title());
}
$publications = $this->publications();
foreach ($publications as $publication) {
$data['publications'][] = $publication->templateData();
}
$images = $this->images();
foreach ($images as $image) {
$data['images'][] = Storage::url($image);
}
// print_r( $data['images'] );
return $data;
}
示例3: getStatistics
public function getStatistics()
{
return ['comments' => Comments::count('user_id = "' . $this->id . '"'), 'tags' => Taggables::count('user_id = "' . $this->id . '"'), 'links' => Links::count('user_id = "' . $this->id . '"'), 'favorites' => Favorites::count('user_id = "' . $this->id . '"')];
}