This commit is contained in:
James Cole
2016-06-16 08:04:22 +02:00
parent e63f216905
commit bdee8cde77

View File

@@ -52,9 +52,9 @@ class AccountCrud implements AccountCrudInterface
* *
* @return bool * @return bool
*/ */
public function destroy(Account $account, Account $moveTo = null): bool public function destroy(Account $account, Account $moveTo): bool
{ {
if (!is_null($moveTo)) { if (!is_null($moveTo->id)) {
// update all transactions: // update all transactions:
DB::table('transactions')->where('account_id', $account->id)->update(['account_id' => $moveTo->id]); DB::table('transactions')->where('account_id', $account->id)->update(['account_id' => $moveTo->id]);
} }
@@ -73,7 +73,7 @@ class AccountCrud implements AccountCrudInterface
{ {
$account = $this->user->accounts()->find($accountId); $account = $this->user->accounts()->find($accountId);
if (is_null($account)) { if (is_null($account)) {
$account = new Account; return new Account;
} }
return $account; return $account;