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


PHP Board::getThreadsForIndex方法代码示例

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


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

示例1: getThreads

 /**
  * Returns a thread and its replies. 
  *
  * @param  \App\Board $board
  * @return Response
  */
 public function getThreads(Board $board)
 {
     // Determine what page we are on.
     $pages = $board->getPageCount();
     $response = [];
     for ($i = 0; $i < $pages; ++$i) {
         $pageArray = ['page' => $i, 'threads' => []];
         $threads = $board->getThreadsForIndex($i);
         foreach ($threads as $thread) {
             $pageArray['threads'][] = ['no' => (int) $thread->board_id, 'last_modified' => (int) $thread->bumped_last->timestamp];
         }
         $response[] = $pageArray;
     }
     return response()->json($response);
 }
开发者ID:LulzNews,项目名称:infinity-next,代码行数:21,代码来源:BoardController.php

示例2: getIndex

 /**
  * Show the board index for the user.
  * This is usually the last few threads, depending on the optional page
  * parameter, which determines the thread offset.
  *
  * @var Board $board
  * @var integer $page
  * @return Response
  */
 public function getIndex(Board $board, $page = 1)
 {
     // Determine what page we are on.
     $pages = $board->getPageCount();
     // Clamp the page to real values.
     if ($page <= 0) {
         $page = 1;
     } elseif ($page > $pages) {
         $page = $pages;
     }
     // Determine if we have a next/prev button.
     $pagePrev = $page > 1 ? $page - 1 : false;
     $pageNext = $page < $pages ? $page + 1 : false;
     // Load our list of threads and their latest replies.
     $posts = $board->getThreadsForIndex($page);
     return $this->apiResponse($posts);
 }
开发者ID:LulzNews,项目名称:infinity-next,代码行数:26,代码来源:BoardController.php

示例3: getIndex

 /**
  * Show the board index for the user.
  * This is usually the last few threads, depending on the optional page
  * parameter, which determines the thread offset.
  *
  * @param  Board  $board
  * @param  integer  $page
  * @return Response
  */
 public function getIndex(Board $board, $page = 1)
 {
     // Determine what page we are on.
     $pages = $board->getPageCount();
     // Clamp the page to real values.
     if ($page <= 0) {
         $page = 1;
     } elseif ($page > $pages) {
         $page = $pages;
     }
     // Determine if we have a next/prev button.
     $pagePrev = $page > 1 ? $page - 1 : false;
     $pageNext = $page < $pages ? $page + 1 : false;
     // Load our list of threads and their latest replies.
     $posts = $board->getThreadsForIndex($page);
     return $this->view(static::VIEW_BOARD, ['board' => &$board, 'posts' => $posts, 'reply_to' => false, 'pages' => $pages, 'page' => $page, 'pagePrev' => $pagePrev, 'pageNext' => $pageNext]);
 }
开发者ID:nitogel,项目名称:infinity-next,代码行数:26,代码来源:BoardController.php


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