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


PHP Post::getUpdates方法代碼示例

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


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

示例1: getThread

 /**
  * Returns a thread and its replies to the client. 
  *
  * @var Board $board
  * @var Post $thread
  * @return Response
  */
 public function getThread(Request $request, Board $board, Post $thread)
 {
     $input = $request->only('updatesOnly', 'updateHtml', 'updatedSince');
     if (isset($input['updatesOnly'])) {
         $updatedSince = Carbon::createFromTimestamp($request->input('updatedSince', 0));
         $includeHTML = isset($input['updateHtml']);
         $posts = Post::getUpdates($updatedSince, $board, $thread, $includeHTML);
         $posts->sortBy('board_id');
         return $posts;
     } else {
         // Pull the thread.
         $thread = $board->getThreadByBoardId($thread);
         if (!$thread) {
             return abort(404);
         }
     }
     return $thread;
 }
開發者ID:JEWSbreaking8chan,項目名稱:infinity-next,代碼行數:25,代碼來源:BoardController.php

示例2: getThread

 /**
  * Returns a thread and its replies to the client. 
  *
  * @param  Request  $request
  * @param  Board    $board
  * @param  Post     $thread
  * @return Response
  */
 public function getThread(Request $request, Board $board, Post $thread, $splice = null)
 {
     $input = $request->only('updatesOnly', 'updateHtml', 'updatedSince');
     if (isset($input['updatesOnly'])) {
         $updatedSince = Carbon::createFromTimestamp($request->input('updatedSince', 0));
         $includeHTML = isset($input['updateHtml']);
         $posts = Post::getUpdates($updatedSince, $board, $thread, $includeHTML);
         $posts->sortBy('board_id');
         return $this->apiResponse($posts);
     }
     return $this->apiResponse($thread);
 }
開發者ID:LulzNews,項目名稱:infinity-next,代碼行數:20,代碼來源:BoardController.php

示例3: putThread

 /**
  * Handles the creation of a new thread or reply.
  *
  * @param  \App\Http\Requests\PostRequest  $request
  * @param  Board  $board
  * @param  Post|null  $thread
  * @return Response (redirects to the thread view)
  */
 public function putThread(PostRequest $request, Board $board, Post $thread = null)
 {
     // Create the post.
     $post = new Post($request->all());
     $post->submitTo($board, $thread);
     // Log staff posts.
     if ($post->capcode_id) {
         $this->log('log.post.capcode', $post, ["board_id" => $post->board_id, "board_uri" => $post->board_uri, "capcode" => $post->capcode->getCapcodeName(), "role" => $post->capcode->role]);
     }
     $input = $request->only('updatesOnly', 'updateHtml', 'updatedSince');
     if ($request->wantsJson()) {
         $updatedSince = Carbon::createFromTimestamp($request->input('updatedSince', Carbon::now()->subMinutes(4)->timestamp));
         $includeHTML = isset($input['updateHtml']);
         $posts = Post::getUpdates($updatedSince, $board, $thread, $includeHTML);
         $post->setAppendHTML($includeHTML);
         $posts->push($post);
         $posts->sortBy('board_id');
         return $posts;
     }
     // Redirect to the new post or thread.
     if ($post->reply_to_board_id) {
         return redirect("{$board->board_uri}/thread/{$post->reply_to_board_id}#{$post->board_id}");
     } else {
         return redirect("{$board->board_uri}/thread/{$post->board_id}#{$post->board_id}");
     }
 }
開發者ID:JEWSbreaking8chan,項目名稱:infinity-next,代碼行數:34,代碼來源:BoardController.php


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