mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-23 15:40:32 -06:00
Expand suppport for new location model in tags.
This commit is contained in:
parent
35649bea5c
commit
7e5d0d455a
@ -100,6 +100,11 @@ SEND_REPORT_JOURNALS=true
|
||||
# Set a Mapbox API key here (see mapbox.com) so there might be a map available at various places.
|
||||
MAPBOX_API_KEY=
|
||||
|
||||
# The map will default to this location:
|
||||
MAP_DEFAULT_LAT=51.983333
|
||||
MAP_DEFAULT_LONG=5.916667
|
||||
MAP_DEFAULT_ZOOM=6
|
||||
|
||||
# Firefly III currently supports two provider for live Currency Exchange Rates:
|
||||
# "fixer", and "ratesapi".
|
||||
# RatesApi.IO (see https://ratesapi.io) is a FREE and OPEN SOURCE live currency exchange rates,
|
||||
|
@ -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.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user