mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Save transactions by moving them.
This commit is contained in:
@@ -46,11 +46,17 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
|
||||
/**
|
||||
* @param Account $account
|
||||
* @param Account $moveTo
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function destroy(Account $account)
|
||||
public function destroy(Account $account, Account $moveTo = null)
|
||||
{
|
||||
if (!is_null($moveTo)) {
|
||||
// update all transactions:
|
||||
DB::table('transactions')->where('account_id', $account->id)->update(['account_id' => $moveTo->id]);
|
||||
}
|
||||
|
||||
$account->delete();
|
||||
|
||||
return true;
|
||||
|
@@ -26,10 +26,11 @@ interface AccountRepositoryInterface
|
||||
|
||||
/**
|
||||
* @param Account $account
|
||||
* @param Account $moveTo
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function destroy(Account $account);
|
||||
public function destroy(Account $account, Account $moveTo = null);
|
||||
|
||||
/**
|
||||
* @param array $types
|
||||
|
Reference in New Issue
Block a user