Some code optimalisations.

This commit is contained in:
James Cole
2018-06-10 16:59:41 +02:00
parent 6743d99d9b
commit 5a058491b0
11 changed files with 40 additions and 11 deletions

View File

@@ -203,6 +203,21 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
return null;
}
/**
* @param int $piggyBankId
*
* @return PiggyBank|null
*/
public function findNull(int $piggyBankId): ?PiggyBank
{
$piggyBank = $this->user->piggyBanks()->where('piggy_banks.id', $piggyBankId)->first(['piggy_banks.*']);
if (null !== $piggyBank) {
return $piggyBank;
}
return null;
}
/**
* Get current amount saved in piggy bank.
*