public function getBoardHistory(Board $board, Post $post) { $posts = $board->posts()->with('op')->withEverything()->where('author_ip', $post->author_ip)->orderBy('post_id', 'desc')->paginate(15); foreach ($posts as $item) { $item->setRelation('board', $board); } return $this->view(static::VIEW_HISTORY, ['posts' => $posts, 'multiboard' => false]); }
/** * Returns a post to the client. * * @var Board $board * @var Post $post * @return Response */ public function getPost(Board $board, Post $post) { // Pull the post. $post = $board->posts()->where('board_id', $post)->withEverything()->firstOrFail(); if (!$post) { return abort(404); } return $post; }
public function getBoardHistory(Board $board, Post $post) { if (!$this->user->canViewHistory($post)) { return abort(403); } $posts = $board->posts()->with('op')->withEverything()->where('author_ip', $post->author_ip)->orderBy('post_id', 'desc')->paginate(15); foreach ($posts as $item) { $item->setRelation('board', $board); } return $this->view(static::VIEW_HISTORY, ['posts' => $posts, 'multiboard' => false, 'ip' => ip_less($post->author_ip->toText())]); }
/** * Redirect from a local id to a thread OP.. * * @param Board $board * @param integer $thread * @return Redirect */ public function getPost(Board $board, $post) { if (is_null($post)) { return redirect($board->board_uri); } // Check to see if the thread exists. $post = $board->posts()->where('board_id', $post)->get()->first(); if (!$post) { return abort(404); } if ($post->reply_to) { return redirect("{$board->board_uri}/thread/{$post->reply_to_board_id}#{$post->board_id}"); } return redirect("{$board->board_uri}/thread/{$post->board_id}"); }