1
0
mirror of https://github.com/flarum/core.git synced 2025-08-27 10:05:47 +02:00

Merge pull request #40 from dshoreman/eagerload

Lazy-load any included relationships on /api/tags
This commit is contained in:
Toby Zerner
2017-04-12 06:38:29 +09:30
committed by GitHub

View File

@@ -57,7 +57,10 @@ class ListTagsController extends AbstractCollectionController
protected function data(ServerRequestInterface $request, Document $document) protected function data(ServerRequestInterface $request, Document $document)
{ {
$actor = $request->getAttribute('actor'); $actor = $request->getAttribute('actor');
$include = $this->extractInclude($request);
return $this->tags->whereVisibleTo($actor)->withStateFor($actor)->get(); $tags = $this->tags->whereVisibleTo($actor)->withStateFor($actor)->get();
return $tags->load($include);
} }
} }