mirror of
https://github.com/flarum/framework.git
synced 2024-12-02 06:53:47 +08:00
Performance: Eager load parent tags
This commit is contained in:
parent
e3e7da3f52
commit
6a21d292c5
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user