Ver código fonte

refactor: TransactionService.php

3.x
wallo 1 ano atrás
pai
commit
048d96060f
2 arquivos alterados com 2 adições e 2 exclusões
  1. 1
    0
      .env.example
  2. 1
    2
      app/Services/TransactionService.php

+ 1
- 0
.env.example Ver arquivo

@@ -73,3 +73,4 @@ TRANSMATIC_STORAGE=file
73 73
 PLAID_CLIENT_ID=
74 74
 PLAID_CLIENT_SECRET=
75 75
 PLAID_ENVIRONMENT=sandbox
76
+PLAID_WEBHOOK_URL=

+ 1
- 2
app/Services/TransactionService.php Ver arquivo

@@ -9,14 +9,13 @@ use App\Models\Accounting\Account;
9 9
 use App\Models\Accounting\Transaction;
10 10
 use App\Models\Banking\BankAccount;
11 11
 use App\Models\Company;
12
-use App\Scopes\CurrentCompanyScope;
13 12
 use Illuminate\Support\Carbon;
14 13
 
15 14
 class TransactionService
16 15
 {
17 16
     public function createStartingBalanceIfNeeded(Company $company, Account $account, BankAccount $bankAccount, array $transactions, float $currentBalance, string $startDate): void
18 17
     {
19
-        if ($account->transactions()->withoutGlobalScope(CurrentCompanyScope::class)->doesntExist()) {
18
+        if ($account->transactions()->doesntExist()) {
20 19
             $accountSign = $account->category === AccountCategory::Asset ? 1 : -1;
21 20
 
22 21
             $sumOfTransactions = collect($transactions)->reduce(static function ($carry, $transaction) {

Carregando…
Cancelar
Salvar