mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-20 16:40:10 +00:00
Add imports for facades
This commit is contained in:
@@ -36,6 +36,7 @@ use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* Class ConvertToWithdrawal
|
||||
@@ -148,14 +149,14 @@ class ConvertToWithdrawal implements ActionInterface
|
||||
app('log')->debug(sprintf('ConvertToWithdrawal. Action value is "%s", expense name is "%s"', $actionValue, $opposingName));
|
||||
|
||||
// update source transaction(s) to be the original destination account
|
||||
\DB::table('transactions')
|
||||
DB::table('transactions')
|
||||
->where('transaction_journal_id', '=', $journal->id)
|
||||
->where('amount', '<', 0)
|
||||
->update(['account_id' => $destAccount->id])
|
||||
;
|
||||
|
||||
// update destination transaction(s) to be new expense account.
|
||||
\DB::table('transactions')
|
||||
DB::table('transactions')
|
||||
->where('transaction_journal_id', '=', $journal->id)
|
||||
->where('amount', '>', 0)
|
||||
->update(['account_id' => $opposingAccount->id])
|
||||
@@ -163,7 +164,7 @@ class ConvertToWithdrawal implements ActionInterface
|
||||
|
||||
// change transaction type of journal:
|
||||
$newType = TransactionType::whereType(TransactionTypeEnum::WITHDRAWAL->value)->first();
|
||||
\DB::table('transaction_journals')
|
||||
DB::table('transaction_journals')
|
||||
->where('id', '=', $journal->id)
|
||||
->update(['transaction_type_id' => $newType->id])
|
||||
;
|
||||
@@ -234,7 +235,7 @@ class ConvertToWithdrawal implements ActionInterface
|
||||
app('log')->debug(sprintf('ConvertToWithdrawal. Action value is "%s", destination name is "%s"', $actionValue, $opposingName));
|
||||
|
||||
// update destination transaction(s) to be new expense account.
|
||||
\DB::table('transactions')
|
||||
DB::table('transactions')
|
||||
->where('transaction_journal_id', '=', $journal->id)
|
||||
->where('amount', '>', 0)
|
||||
->update(['account_id' => $opposingAccount->id])
|
||||
@@ -242,7 +243,7 @@ class ConvertToWithdrawal implements ActionInterface
|
||||
|
||||
// change transaction type of journal:
|
||||
$newType = TransactionType::whereType(TransactionTypeEnum::WITHDRAWAL->value)->first();
|
||||
\DB::table('transaction_journals')
|
||||
DB::table('transaction_journals')
|
||||
->where('id', '=', $journal->id)
|
||||
->update(['transaction_type_id' => $newType->id])
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user