This commit is contained in:
James Cole
2018-06-01 13:11:10 +02:00
parent 3654e75b8c
commit 4c04415e80
5 changed files with 27 additions and 18 deletions

View File

@@ -336,7 +336,6 @@ class TagRepository implements TagRepositoryInterface
}
)
->groupBy(['tags.id', 'tags.tag']);
// add date range (or not):
if (null === $year) {
Log::debug('Get tags without a date.');
@@ -464,4 +463,13 @@ class TagRepository implements TagRepositoryInterface
{
return $this->user->tags()->find($tagId);
}
}
/**
* Will return the newest tag (if known) or NULL.
*
* @return Tag|null
*/
public function newestTag(): ?Tag
{
return $this->user->tags()->whereNotNull('date')->orderBy('date', 'DESC')->first();
}}

View File

@@ -116,10 +116,16 @@ interface TagRepositoryInterface
public function lastUseDate(Tag $tag): Carbon;
/**
* Will return the newest tag (if known) or NULL.
* @return Tag|null
*/
public function oldestTag(): ?Tag;
/**
* Will return the newest tag (if known) or NULL.
* @return Tag|null
*/
public function newestTag(): ?Tag;
/**
* @param User $user
*/