mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-05-05 05:33:36 +00:00
🤖 Auto commit for release 'develop' on 2026-02-06
This commit is contained in:
@@ -51,17 +51,6 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface, UserGroup
|
||||
}
|
||||
}
|
||||
|
||||
public function get(): Collection
|
||||
{
|
||||
return $this->user
|
||||
->objectGroups()
|
||||
->with(['piggyBanks', 'bills'])
|
||||
->orderBy('order', 'ASC')
|
||||
->orderBy('title', 'ASC')
|
||||
->get()
|
||||
;
|
||||
}
|
||||
|
||||
public function deleteEmpty(): void
|
||||
{
|
||||
$all = $this->get();
|
||||
@@ -87,6 +76,17 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface, UserGroup
|
||||
$objectGroup->delete();
|
||||
}
|
||||
|
||||
public function get(): Collection
|
||||
{
|
||||
return $this->user
|
||||
->objectGroups()
|
||||
->with(['piggyBanks', 'bills'])
|
||||
->orderBy('order', 'ASC')
|
||||
->orderBy('title', 'ASC')
|
||||
->get()
|
||||
;
|
||||
}
|
||||
|
||||
public function getBills(ObjectGroup $objectGroup): Collection
|
||||
{
|
||||
return $objectGroup->bills;
|
||||
@@ -139,21 +139,6 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface, UserGroup
|
||||
return $dbQuery->take($limit)->get(['object_groups.*']);
|
||||
}
|
||||
|
||||
public function update(ObjectGroup $objectGroup, array $data): ObjectGroup
|
||||
{
|
||||
if (array_key_exists('title', $data)) {
|
||||
$objectGroup->title = $data['title'];
|
||||
}
|
||||
|
||||
if (array_key_exists('order', $data)) {
|
||||
$this->setOrder($objectGroup, (int) $data['order']);
|
||||
}
|
||||
|
||||
$objectGroup->save();
|
||||
|
||||
return $objectGroup;
|
||||
}
|
||||
|
||||
public function setOrder(ObjectGroup $objectGroup, int $newOrder): ObjectGroup
|
||||
{
|
||||
$oldOrder = $objectGroup->order;
|
||||
@@ -187,4 +172,19 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface, UserGroup
|
||||
|
||||
return $objectGroup;
|
||||
}
|
||||
|
||||
public function update(ObjectGroup $objectGroup, array $data): ObjectGroup
|
||||
{
|
||||
if (array_key_exists('title', $data)) {
|
||||
$objectGroup->title = $data['title'];
|
||||
}
|
||||
|
||||
if (array_key_exists('order', $data)) {
|
||||
$this->setOrder($objectGroup, (int) $data['order']);
|
||||
}
|
||||
|
||||
$objectGroup->save();
|
||||
|
||||
return $objectGroup;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user