mirror of
https://github.com/flarum/core.git
synced 2025-08-24 17:13:44 +02:00
Performance: Eager load parent tags
This commit is contained in:
@@ -68,7 +68,10 @@ class AddForumTagsRelationship
|
|||||||
// doesn't actually have a tags relationship, we will manually load and
|
// doesn't actually have a tags relationship, we will manually load and
|
||||||
// assign the tags data to it using an event listener.
|
// assign the tags data to it using an event listener.
|
||||||
if ($event->isController(ShowForumController::class)) {
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user