1
0
mirror of https://github.com/flarum/core.git synced 2025-10-11 06:54:26 +02:00

Performance: Assign parent discussion to posts so it doesn't have to be reloaded

This commit is contained in:
Toby Zerner
2017-11-11 22:44:45 +10:30
parent 1a102766a9
commit 5f7060fb4a
2 changed files with 20 additions and 2 deletions

View File

@@ -173,6 +173,12 @@ class ShowDiscussionController extends AbstractResourceController
$query->orderBy('time')->skip($offset)->take($limit)->with($include);
return $query->get()->all();
$posts = $query->get()->all();
foreach ($posts as $post) {
$post->discussion = $discussion;
}
return $posts;
}
}