public function getPageOfPost($post, $perPage) { $numPosts = $this->database->table('posts')->where('conversation_id', $post->conversation_id)->where('posted', '<', $post->posted)->count('id') + 1; return ceil($numPosts / $perPage); }