Пример #1
0
 protected function handleRequest(Request $request)
 {
     $pid = \Route::input('id');
     // If a post ID is specified we determine topic ID and page number so we can show the correct message
     $this->post = Post::findOrFail($pid);
     // Determine on which page the post is located
     $numPosts = Post::where('topic_id', '=', $this->post->topic_id)->where('posted', '<', $this->post->posted)->count('id') + 1;
     $dispPosts = User::current()->dispPosts();
     $this->page = ceil($numPosts / $dispPosts);
 }
Пример #2
0
 public function get_post($pid)
 {
     // If a post ID is specified we determine topic ID and page number so we can show the correct message
     $post = Post::where('id', '=', $pid)->select(array('topic_id', 'posted'))->first();
     if ($post === NULL) {
         return \Event::first('404');
     }
     $tid = $post->topic_id;
     $posted = $post->posted;
     // Determine on what page the post is located (depending on $forum_user['disp_posts'])
     $num_posts = Post::where('topic_id', '=', $tid)->where('posted', '<', $posted)->count('id') + 1;
     $disp_posts = $this->user()->dispPosts();
     $p = ceil($num_posts / $disp_posts);
     // FIXME: second parameter for $page number
     return $this->get_topic($tid);
 }