@JarekTkaczyk from seeding my database with random threads and posts.
A Thread (that has been answered) takes me to page 1 but the answer is actually on page 3... Ok, so it looks like it is always taking me to page 1.
public function showAnswer($thread_id, $answer_id)
{
$perPage = 12;
$post = Post::find($answer_id);
$thread = Thread::find($thread_id);
$page = $thread->posts() //
->latest()
->selectRaw('ceil(count(*) / ?) as page', [$perPage])
->where('created_at', '>=', $post->created_at)
->pluck('page');
$anchor = $post->id; // get the html anchor of the answer, id or whatever you use
return redirect("/discussion/$thread_id/?page={$page}#{$anchor}");
// the url might be something like "/threads/{$post->thread_id}?page..."
}
If I change the ordering to be oldest() (as that is how I show my posts) then I get random pages.

