当前位置: 首页>>代码示例>>PHP>>正文


PHP Forum::count方法代码示例

本文整理汇总了PHP中Forum::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Forum::count方法的具体用法?PHP Forum::count怎么用?PHP Forum::count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Forum的用法示例。


在下文中一共展示了Forum::count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: to_array

 /**
  * @return array
  */
 public function to_array()
 {
     return array_merge(['author' => $this->author->to_array(), 'forum' => $this->forum_id ? $this->forum->to_array() : [], 'subjects' => $this->forum_id ? 0 : Forum::count(['conditions' => ['forum_id = ?', $this->id]]), 'topics' => $this->forum_id ? ForumTheme::count(['conditions' => ['forum_id = ?', $this->id]]) : 0], parent::to_array());
 }
开发者ID:Max201,项目名称:nanocore,代码行数:7,代码来源:Forum.php

示例2: subjects

 public function subjects(Request $request, $matches)
 {
     $title = $this->lang->translate('forum.list');
     // Delete topic
     if ($request->get('delete')) {
         $forum = \Forum::find_by_id(intval($request->get('delete')));
         if ($forum) {
             $forum->delete();
             $this->view->assign('message', $this->lang->translate('form.deleted'));
         }
     }
     // Filter
     $filter = ['conditions' => ['forum_id < 1']];
     if ($request->get('author')) {
         $author = \User::find($request->get('author'));
         if ($author) {
             $filter['conditions'] = ['author_id = ?', $author->id];
         }
     }
     // Parent
     if ($request->get('parent')) {
         $parent = \Forum::find($request->get('parent'));
         if ($parent) {
             $filter['conditions'] = ['forum_id = ?', $parent->id];
         }
     }
     $filter['order'] = 'id DESC';
     if ($request->order) {
         $filter['order'] = $request->order;
     }
     /** @var Listing $paginator */
     $paginator = NCService::load('Paginator.Listing', [$request->page, \Forum::count('all')]);
     $filter = array_merge($filter, $paginator->limit());
     // Filter topics
     $forums = \Forum::as_array(\Forum::all($filter));
     return $this->view->render('forum/list.twig', ['title' => $title, 'forums_list' => $forums, 'listing' => $paginator->pages(), 'page' => $paginator->cur_page]);
 }
开发者ID:Max201,项目名称:nanocore,代码行数:37,代码来源:Control.php


注:本文中的Forum::count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。