本文整理汇总了PHP中app\Post::submitTo方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::submitTo方法的具体用法?PHP Post::submitTo怎么用?PHP Post::submitTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Post
的用法示例。
在下文中一共展示了Post::submitTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: putThread
/**
* Handles the creation of a new thread or reply.
*
* @param \App\Http\Requests\PostRequest $request
* @param Board $board
* @param integer|null $thread
* @return Response (redirects to the thread view)
*/
public function putThread(PostRequest $request, Board $board, $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->capcode, "role" => $post->capcode->role]);
}
// Redirect to the new post or thread.
if (is_null($thread)) {
return redirect("{$board->board_uri}/thread/{$post->board_id}");
} else {
return redirect("{$board->board_uri}/thread/{$post->reply_to_board_id}#{$post->board_id}");
}
}
示例2: 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}");
}
}