Performance: Eager load parent tags

This commit is contained in:
Toby Zerner 2017-11-11 22:40:22 +10:30
parent e3e7da3f52
commit 6a21d292c5

View File

@ -68,7 +68,10 @@ class AddForumTagsRelationship
// doesn't actually have a tags relationship, we will manually load and
// assign the tags data to it using an event listener.
if ($event->isController(ShowForumController::class)) {
$event->data['tags'] = Tag::whereVisibleTo($event->actor)->withStateFor($event->actor)->with('lastDiscussion')->get();
$event->data['tags'] = Tag::whereVisibleTo($event->actor)
->withStateFor($event->actor)
->with(['parent', 'lastDiscussion'])
->get();
}
}