API for object groups.

This commit is contained in:
James Cole
2020-06-20 16:28:23 +02:00
parent c40f6f2864
commit 1a154a8d45
11 changed files with 416 additions and 2 deletions

View File

@@ -107,6 +107,12 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface
public function update(ObjectGroup $objectGroup, array $data): ObjectGroup
{
$objectGroup->title = $data['title'];
if (isset($data['order'])) {
$order = 0 === $data['order'] ? 1 : $data['order'];
$objectGroup->order = $order;
}
$objectGroup->save();
return $objectGroup;
@@ -128,4 +134,11 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface
$this->user = $user;
}
/**
* @inheritDoc
*/
public function getPiggyBanks(ObjectGroup $objectGroup): Collection
{
return $objectGroup->piggyBanks;
}
}