mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-06 22:21:42 +00:00
Move stuff to request classes for #339
This commit is contained in:
@@ -175,7 +175,8 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
||||
*/
|
||||
public function store(array $data): PiggyBank
|
||||
{
|
||||
$piggyBank = PiggyBank::create($data);
|
||||
$data['order'] = $this->getMaxOrder() + 1;
|
||||
$piggyBank = PiggyBank::create($data);
|
||||
|
||||
$this->updateNote($piggyBank, $data['note']);
|
||||
|
||||
@@ -232,9 +233,9 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
$dbNote= $piggyBank->notes()->first();
|
||||
$dbNote = $piggyBank->notes()->first();
|
||||
if (is_null($dbNote)) {
|
||||
$dbNote= new Note();
|
||||
$dbNote = new Note();
|
||||
$dbNote->noteable()->associate($piggyBank);
|
||||
}
|
||||
$dbNote->text = trim($note);
|
||||
|
||||
@@ -79,6 +79,21 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $ruleGroupId
|
||||
*
|
||||
* @return RuleGroup
|
||||
*/
|
||||
public function find(int $ruleGroupId): RuleGroup
|
||||
{
|
||||
$group = $this->user->ruleGroups()->find($ruleGroupId);
|
||||
if (is_null($group)) {
|
||||
return new RuleGroup;
|
||||
}
|
||||
|
||||
return $group;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
|
||||
@@ -42,6 +42,13 @@ interface RuleGroupRepositoryInterface
|
||||
*/
|
||||
public function destroy(RuleGroup $ruleGroup, RuleGroup $moveTo = null): bool;
|
||||
|
||||
/**
|
||||
* @param int $ruleGroupId
|
||||
*
|
||||
* @return RuleGroup
|
||||
*/
|
||||
public function find(int $ruleGroupId): RuleGroup;
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user