mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-10 12:24:50 +00:00
First attempt at basic tag functionality.
This commit is contained in:
39
app/Repositories/Tag/TagRepository.php
Normal file
39
app/Repositories/Tag/TagRepository.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace FireflyIII\Repositories\Tag;
|
||||
|
||||
|
||||
use Auth;
|
||||
use FireflyIII\Models\Tag;
|
||||
|
||||
/**
|
||||
* Class TagRepository
|
||||
*
|
||||
* @package FireflyIII\Repositories\Tag
|
||||
*/
|
||||
class TagRepository implements TagRepositoryInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
* @return Tag
|
||||
*/
|
||||
public function store(array $data)
|
||||
{
|
||||
$tag = new Tag;
|
||||
$tag->tag = $data['tag'];
|
||||
$tag->date = $data['date'];
|
||||
$tag->description = $data['description'];
|
||||
$tag->latitude = $data['latitude'];
|
||||
$tag->longitude = $data['longitude'];
|
||||
$tag->zoomLevel = $data['zoomLevel'];
|
||||
$tag->tagMode = $data['tagMode'];
|
||||
$tag->user()->associate(Auth::user());
|
||||
$tag->save();
|
||||
|
||||
return $tag;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
20
app/Repositories/Tag/TagRepositoryInterface.php
Normal file
20
app/Repositories/Tag/TagRepositoryInterface.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace FireflyIII\Repositories\Tag;
|
||||
use FireflyIII\Models\Tag;
|
||||
|
||||
|
||||
/**
|
||||
* Interface TagRepositoryInterface
|
||||
*
|
||||
* @package FireflyIII\Repositories\Tag
|
||||
*/
|
||||
interface TagRepositoryInterface {
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
* @return Tag
|
||||
*/
|
||||
public function store(array $data);
|
||||
}
|
||||
Reference in New Issue
Block a user