浏览代码

refactor: TransactionService.php

3.x
wallo 1年前
父节点
当前提交
048d96060f
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1
    0
      .env.example
  2. 1
    2
      app/Services/TransactionService.php

+ 1
- 0
.env.example 查看文件

73
 PLAID_CLIENT_ID=
73
 PLAID_CLIENT_ID=
74
 PLAID_CLIENT_SECRET=
74
 PLAID_CLIENT_SECRET=
75
 PLAID_ENVIRONMENT=sandbox
75
 PLAID_ENVIRONMENT=sandbox
76
+PLAID_WEBHOOK_URL=

+ 1
- 2
app/Services/TransactionService.php 查看文件

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

正在加载...
取消
保存