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


PHP Board::getThreadByBoardId方法代码示例

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


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

示例1: getThread

 /**
  * Renders a thread.
  *
  * @param  Board  $board
  * @param  integer|null  $thread
  * @return Response
  */
 public function getThread(Board $board, $thread_id = null)
 {
     if (is_null($thread_id)) {
         return redirect($board->board_uri);
     }
     // Pull the thread.
     $thread = $board->getThreadByBoardId($thread_id);
     if (!$thread) {
         return abort(404);
     }
     return $this->view(static::VIEW_THREAD, ['board' => &$board, 'posts' => [$thread], 'reply_to' => $thread]);
 }
开发者ID:nitogel,项目名称:infinity-next,代码行数:19,代码来源:BoardController.php

示例2: getThread

 /**
  * Returns a thread and its replies to the client. 
  *
  * @var Board $board
  * @var integer|null $thread
  * @return Response
  */
 public function getThread(Request $request, Board $board, $thread)
 {
     if (is_null($thread)) {
         return abort(404);
     }
     $input = $request->only('updatesOnly', 'updateHtml', 'updatedSince');
     if (isset($input['updatesOnly'])) {
         $updatedSince = Carbon::createFromTimestamp($request->input('updatedSince', 0));
         $posts = Post::where('posts.board_uri', $board->board_uri)->withEverything()->where(function ($query) use($thread) {
             $query->where('posts.reply_to_board_id', $thread);
             $query->orWhere('posts.board_id', $thread);
         })->where(function ($query) use($updatedSince) {
             $query->where('posts.updated_at', '>=', $updatedSince);
             $query->orWhere('posts.deleted_at', '>=', $updatedSince);
         })->withTrashed()->orderBy('posts.created_at', 'asc')->get();
         if (isset($input['updateHtml'])) {
             foreach ($posts as $post) {
                 $appends = $post->getAppends();
                 $appends[] = "html";
                 $post->setAppends($appends);
             }
         }
         return $posts;
     } else {
         // Pull the thread.
         $thread = $board->getThreadByBoardId($thread);
         if (!$thread) {
             return abort(404);
         }
     }
     return $thread;
 }
开发者ID:nitogel,项目名称:infinity-next,代码行数:39,代码来源:BoardController.php


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