mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 16:57:09 +00:00
Move code to repository.
This commit is contained in:
@@ -163,6 +163,24 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
||||
return new PiggyBank();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current amount saved in piggy bank.
|
||||
*
|
||||
* @param PiggyBank $piggyBank
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrentAmount(PiggyBank $piggyBank): string
|
||||
{
|
||||
/** @var PiggyBankRepetition $rep */
|
||||
$rep = $piggyBank->piggyBankRepetitions()->first(['piggy_bank_repetitions.*']);
|
||||
if (null === $rep) {
|
||||
return '0';
|
||||
}
|
||||
|
||||
return strval($rep->currentamount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PiggyBank $piggyBank
|
||||
*
|
||||
|
Reference in New Issue
Block a user