예제 #1
0
 /**
  * Check the request for all post controller methods.
  *
  * @var Board $board
  * @var Post $post
  * @return HttpException|RedirectResponse|Post
  */
 protected function validatePost(Board $board, $post)
 {
     if ($post instanceof Post) {
         return $post;
     }
     // If no post is specified, we can't do anything.
     // Push the user to the index.
     if (is_null($post)) {
         return redirect($board->board_uri);
     }
     // Find the post.
     $post = $board->getLocalReply($post);
     if (!$post) {
         return abort(404);
     }
     return $post;
 }