Show attachments to tags #2828

This commit is contained in:
James Cole
2020-03-19 18:51:47 +01:00
parent 64683647bd
commit 6dba44ba71
4 changed files with 28 additions and 9 deletions

View File

@@ -185,7 +185,7 @@ class TagRepository implements TagRepositoryInterface
public function getTagsInYear(?int $year): array
{
// get all tags in the year (if present):
$tagQuery = $this->user->tags()->with(['locations'])->orderBy('tags.tag');
$tagQuery = $this->user->tags()->with(['locations', 'attachments'])->orderBy('tags.tag');
// add date range (or not):
if (null === $year) {
@@ -203,10 +203,11 @@ class TagRepository implements TagRepositoryInterface
foreach ($collection as $tag) {
// return value for tag cloud:
$return[$tag->id] = [
'tag' => $tag->tag,
'id' => $tag->id,
'created_at' => $tag->created_at,
'location' => $tag->locations->first(),
'tag' => $tag->tag,
'id' => $tag->id,
'created_at' => $tag->created_at,
'location' => $tag->locations->first(),
'attachments' => $tag->attachments,
];
}