mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-06 12:45:30 +00:00
Group management code.
This commit is contained in:
@@ -6,14 +6,13 @@ namespace FireflyIII\Repositories\ObjectGroup;
|
||||
use DB;
|
||||
use FireflyIII\Models\ObjectGroup;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class ObjectGroupRepository
|
||||
*/
|
||||
class ObjectGroupRepository implements ObjectGroupRepositoryInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@@ -73,4 +72,37 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface
|
||||
$group->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function setOrder(ObjectGroup $objectGroup, int $order): ObjectGroup
|
||||
{
|
||||
$order = 0 === $order ? 1 : $order;
|
||||
$objectGroup->order = $order;
|
||||
$objectGroup->save();
|
||||
|
||||
Log::debug(sprintf('Objectgroup #%d order is now %d', $objectGroup->id, $order));
|
||||
|
||||
return $objectGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function update(ObjectGroup $objectGroup, array $data): ObjectGroup
|
||||
{
|
||||
$objectGroup->title = $data['title'];
|
||||
$objectGroup->save();
|
||||
|
||||
return $objectGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function destroy(ObjectGroup $objectGroup): void
|
||||
{
|
||||
$objectGroup->delete();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user