當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Forum::all方法代碼示例

本文整理匯總了PHP中Forum::all方法的典型用法代碼示例。如果您正苦於以下問題:PHP Forum::all方法的具體用法?PHP Forum::all怎麽用?PHP Forum::all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Forum的用法示例。


在下文中一共展示了Forum::all方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: index

 /**
  * Список форумов
  */
 public function index()
 {
     $forums = Forum::all(['conditions' => ['parent_id = ?', 0], 'order' => 'sort', 'include' => ['topic_count', 'children' => ['post_count', 'topic_count'], 'topic_last' => ['post_last' => ['user']]]]);
     App::view('forums.index', compact('forums'));
 }
開發者ID:visavi,項目名稱:rotorcms,代碼行數:8,代碼來源:ForumController.php


注:本文中的Forum::all方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。