mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-19 04:49:30 +00:00
Expand suppport for new location model in tags.
This commit is contained in:
@@ -26,6 +26,7 @@ use Carbon\Carbon;
|
||||
use DB;
|
||||
use FireflyIII\Factory\TagFactory;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Models\Location;
|
||||
use FireflyIII\Models\Tag;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\User;
|
||||
@@ -363,6 +364,7 @@ class TagRepository implements TagRepositoryInterface
|
||||
'tag' => $tag->tag,
|
||||
'id' => $tag->id,
|
||||
'created_at' => $tag->created_at,
|
||||
'location' => $this->getLocation($tag),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -501,4 +503,12 @@ class TagRepository implements TagRepositoryInterface
|
||||
$tag->delete();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getLocation(Tag $tag): ?Location
|
||||
{
|
||||
return $tag->locations()->first();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Repositories\Tag;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Models\Location;
|
||||
use FireflyIII\Models\Tag;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
@@ -32,6 +33,16 @@ use Illuminate\Support\Collection;
|
||||
*/
|
||||
interface TagRepositoryInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* Return location, or NULL.
|
||||
*
|
||||
* @param Tag $tag
|
||||
*
|
||||
* @return Location|null
|
||||
*/
|
||||
public function getLocation(Tag $tag): ?Location;
|
||||
|
||||
/**
|
||||
* Destroy all tags.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user