瀏覽代碼

feat: exchange rate fluctuation adjustments

3.x
wallo 1 年之前
父節點
當前提交
e8b21495d3

+ 3
- 2
app/Casts/MoneyCast.php 查看文件

@@ -3,6 +3,7 @@
3 3
 namespace App\Casts;
4 4
 
5 5
 use App\Utilities\Currency\CurrencyAccessor;
6
+use App\Utilities\Currency\CurrencyConverter;
6 7
 use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
7 8
 use Illuminate\Database\Eloquent\Model;
8 9
 use UnexpectedValueException;
@@ -14,7 +15,7 @@ class MoneyCast implements CastsAttributes
14 15
         $currency_code = $model->getAttribute('currency_code') ?? CurrencyAccessor::getDefaultCurrency();
15 16
 
16 17
         if ($value !== null) {
17
-            return money($value, $currency_code)->formatSimple();
18
+            return CurrencyConverter::prepareForMutator($value, $currency_code);
18 19
         }
19 20
 
20 21
         return '';
@@ -37,6 +38,6 @@ class MoneyCast implements CastsAttributes
37 38
             throw new UnexpectedValueException('Expected string or numeric value for money cast');
38 39
         }
39 40
 
40
-        return money($value, $currency_code, true)->getAmount();
41
+        return CurrencyConverter::prepareForAccessor($value, $currency_code);
41 42
     }
42 43
 }

+ 3
- 2
app/Casts/TransactionAmountCast.php 查看文件

@@ -3,6 +3,7 @@
3 3
 namespace App\Casts;
4 4
 
5 5
 use App\Utilities\Currency\CurrencyAccessor;
6
+use App\Utilities\Currency\CurrencyConverter;
6 7
 use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
7 8
 use Illuminate\Database\Eloquent\Model;
8 9
 use UnexpectedValueException;
@@ -15,7 +16,7 @@ class TransactionAmountCast implements CastsAttributes
15 16
         $currency_code = $model->bankAccount?->account?->currency_code ?? CurrencyAccessor::getDefaultCurrency();
16 17
 
17 18
         if ($value !== null) {
18
-            return money($value, $currency_code)->formatSimple();
19
+            return CurrencyConverter::prepareForMutator($value, $currency_code);
19 20
         }
20 21
 
21 22
         return '';
@@ -38,6 +39,6 @@ class TransactionAmountCast implements CastsAttributes
38 39
             throw new UnexpectedValueException('Expected string or numeric value for money cast');
39 40
         }
40 41
 
41
-        return money($value, $currency_code, true)->getAmount();
42
+        return CurrencyConverter::prepareForAccessor($value, $currency_code);
42 43
     }
43 44
 }

+ 7
- 1
app/Events/CurrencyRateChanged.php 查看文件

@@ -15,11 +15,17 @@ class CurrencyRateChanged
15 15
 
16 16
     public Currency $currency;
17 17
 
18
+    public float $oldRate;
19
+
20
+    public float $newRate;
21
+
18 22
     /**
19 23
      * Create a new event instance.
20 24
      */
21
-    public function __construct(Currency $currency)
25
+    public function __construct(Currency $currency, float $oldRate, float $newRate)
22 26
     {
23 27
         $this->currency = $currency;
28
+        $this->oldRate = $oldRate;
29
+        $this->newRate = $newRate;
24 30
     }
25 31
 }

+ 2
- 7
app/Filament/Company/Pages/Accounting/Transactions.php 查看文件

@@ -713,10 +713,10 @@ class Transactions extends Page implements HasTable
713 713
             ->get()
714 714
             ->groupBy('account.subtype.name')
715 715
             ->mapWithKeys(function (Collection $bankAccounts, string $subtype) use ($isFilter) {
716
-                return [$subtype => $bankAccounts->mapWithKeys(function (BankAccount $bankAccount) use ($isFilter) {
716
+                return [$subtype => $bankAccounts->mapWithKeys(static function (BankAccount $bankAccount) use ($isFilter) {
717 717
                     $label = $bankAccount->account->name;
718 718
                     if ($isFilter) {
719
-                        $balance = $this->getAccountBalance($bankAccount->account);
719
+                        $balance = $bankAccount->account->ending_balance->convert()->formatWithCode(true);
720 720
                         $label .= "<span class='float-right'>{$balance}</span>";
721 721
                     }
722 722
 
@@ -728,11 +728,6 @@ class Transactions extends Page implements HasTable
728 728
         return array_merge($options, $bankAccountOptions);
729 729
     }
730 730
 
731
-    protected function getAccountBalance(Account $account): ?string
732
-    {
733
-        return Accounting::getEndingBalance($account, $this->fiscalYearStartDate, $this->fiscalYearEndDate)?->formattedForDisplay();
734
-    }
735
-
736 731
     protected function getBalanceForAllAccounts(): string
737 732
     {
738 733
         return Accounting::getTotalBalanceForAllBankAccounts($this->fiscalYearStartDate, $this->fiscalYearEndDate)->formatted();

+ 1
- 0
app/Filament/Company/Resources/Banking/AccountResource.php 查看文件

@@ -176,6 +176,7 @@ class AccountResource extends Resource
176 176
                     ->sortable(),
177 177
                 Tables\Columns\TextColumn::make('account.ending_balance')
178 178
                     ->localizeLabel('Current Balance')
179
+                    ->state(static fn (BankAccount $record) => $record->account->ending_balance->convert()->formatWithCode())
179 180
                     ->sortable(),
180 181
             ])
181 182
             ->filters([

+ 36
- 15
app/Listeners/UpdateAccountBalances.php 查看文件

@@ -2,7 +2,12 @@
2 2
 
3 3
 namespace App\Listeners;
4 4
 
5
+use App\Enums\Accounting\TransactionType;
5 6
 use App\Events\CurrencyRateChanged;
7
+use App\Models\Accounting\Account;
8
+use App\Models\Accounting\Transaction;
9
+use App\Models\Banking\BankAccount;
10
+use App\Utilities\Currency\CurrencyConverter;
6 11
 use Illuminate\Support\Facades\DB;
7 12
 
8 13
 class UpdateAccountBalances
@@ -21,26 +26,42 @@ class UpdateAccountBalances
21 26
     public function handle(CurrencyRateChanged $event): void
22 27
     {
23 28
         DB::transaction(static function () use ($event) {
24
-            $accounts = $event->currency->accounts;
29
+            $bankAccounts = BankAccount::with('account')
30
+                ->whereHas('account', static function ($query) use ($event) {
31
+                    $query->where('currency_code', $event->currency->code);
32
+                })
33
+                ->get();
25 34
 
26
-            foreach ($accounts as $account) {
27
-                $initialHistory = $account->histories()->where('account_id', $account->id)
28
-                    ->orderBy('created_at')
29
-                    ->first();
35
+            foreach ($bankAccounts as $bankAccount) {
36
+                /** @var BankAccount $bankAccount */
37
+                $account = $bankAccount->account;
30 38
 
31
-                if ($initialHistory) {
32
-                    $originalBalance = $initialHistory->balance;
33
-                    $originalBalance = money($originalBalance, $account->currency->code)->getAmount();
34
-                    $originalRate = $initialHistory->exchange_rate;
35
-                    $precision = $account->currency->precision;
39
+                $oldConvertedBalanceInCents = $account->ending_balance->convert()->getConvertedValue();
40
+                $newConvertedBalance = ($event->newRate / $event->oldRate) * $oldConvertedBalanceInCents;
41
+                $newConvertedBalanceInCents = (int) round($newConvertedBalance);
36 42
 
37
-                    $newRate = $event->currency->rate;
38
-                    $newBalance = ($newRate / $originalRate) * $originalBalance;
43
+                $differenceInCents = $newConvertedBalanceInCents - $oldConvertedBalanceInCents;
39 44
 
40
-                    $newBalanceScaled = round($newBalance, $precision);
45
+                if ($differenceInCents !== 0) {
46
+                    $gainOrLossAccountName = $differenceInCents > 0 ? 'Gain on Foreign Exchange' : 'Loss on Foreign Exchange';
47
+                    $gainOrLossAccount = Account::where('name', $gainOrLossAccountName)->first();
48
+                    $transactionType = $differenceInCents > 0 ? TransactionType::Deposit : TransactionType::Withdrawal;
49
+                    $description = "Exchange rate adjustment due to rate change from {$event->oldRate} to {$event->newRate}";
50
+                    $absoluteDifferenceAmountInCents = abs($differenceInCents);
51
+                    $formattedSimpleDifference = CurrencyConverter::prepareForMutator($absoluteDifferenceAmountInCents, $bankAccount->account->currency_code);
41 52
 
42
-                    $account->balance = $newBalanceScaled;
43
-                    $account->save();
53
+                    Transaction::create([
54
+                        'company_id' => $account->company_id,
55
+                        'account_id' => $gainOrLossAccount->id,
56
+                        'bank_account_id' => $bankAccount->id,
57
+                        'type' => $transactionType,
58
+                        'amount' => $formattedSimpleDifference,
59
+                        'payment_channel' => 'other',
60
+                        'posted_at' => now(),
61
+                        'description' => $description,
62
+                        'pending' => false,
63
+                        'reviewed' => false,
64
+                    ]);
44 65
                 }
45 66
             }
46 67
         });

+ 5
- 1
app/Livewire/Company/Service/LiveCurrency/ListCompanyCurrencies.php 查看文件

@@ -43,7 +43,11 @@ class ListCompanyCurrencies extends Component implements HasForms, HasTable
43 43
                             'Record' => $this->getTableModelLabel(),
44 44
                         ]);
45 45
 
46
-                        return $record->isEnabled() ? $tooltipMessage : null;
46
+                        if ($record->isEnabled()) {
47
+                            return $tooltipMessage;
48
+                        }
49
+
50
+                        return null;
47 51
                     })
48 52
                     ->iconPosition(IconPosition::After)
49 53
                     ->sortable()

+ 1
- 1
app/Models/Accounting/Account.php 查看文件

@@ -100,7 +100,7 @@ class Account extends Model
100 100
             $fiscalYearStart = $company->locale->fiscalYearStartDate();
101 101
             $fiscalYearEnd = $company->locale->fiscalYearEndDate();
102 102
 
103
-            return Accounting::getEndingBalance($this, $fiscalYearStart, $fiscalYearEnd)?->formattedForDisplay();
103
+            return Accounting::getEndingBalance($this, $fiscalYearStart, $fiscalYearEnd);
104 104
         });
105 105
     }
106 106
 

+ 3
- 0
app/Models/Setting/Currency.php 查看文件

@@ -10,8 +10,10 @@ use App\Concerns\SyncsWithCompanyDefaults;
10 10
 use App\Facades\Forex;
11 11
 use App\Models\Accounting\Account;
12 12
 use App\Models\History\AccountHistory;
13
+use App\Observers\CurrencyObserver;
13 14
 use App\Utilities\Currency\CurrencyAccessor;
14 15
 use Database\Factories\Setting\CurrencyFactory;
16
+use Illuminate\Database\Eloquent\Attributes\ObservedBy;
15 17
 use Illuminate\Database\Eloquent\Casts\Attribute;
16 18
 use Illuminate\Database\Eloquent\Factories\Factory;
17 19
 use Illuminate\Database\Eloquent\Factories\HasFactory;
@@ -19,6 +21,7 @@ use Illuminate\Database\Eloquent\Model;
19 21
 use Illuminate\Database\Eloquent\Relations\HasMany;
20 22
 use Illuminate\Database\Eloquent\Relations\HasOne;
21 23
 
24
+#[ObservedBy(CurrencyObserver::class)]
22 25
 class Currency extends Model
23 26
 {
24 27
     use Blamable;

+ 1
- 1
app/Observers/CurrencyObserver.php 查看文件

@@ -26,7 +26,7 @@ class CurrencyObserver
26 26
         }
27 27
 
28 28
         if ($currency->wasChanged('rate')) {
29
-            event(new CurrencyRateChanged($currency));
29
+            event(new CurrencyRateChanged($currency, $currency->getOriginal('rate'), $currency->rate));
30 30
         }
31 31
     }
32 32
 

+ 4
- 2
app/Observers/TransactionObserver.php 查看文件

@@ -61,9 +61,11 @@ class TransactionObserver
61 61
 
62 62
     private function convertToDefaultCurrency(string $amount, string $fromCurrency, string $toCurrency): string
63 63
     {
64
-        $amountInCents = CurrencyConverter::convertFormattedBalance($amount, $fromCurrency, $toCurrency);
64
+        $amountInCents = CurrencyConverter::prepareForAccessor($amount, $fromCurrency);
65 65
 
66
-        return money($amountInCents, $toCurrency)->formatSimple();
66
+        $convertedAmountInCents = CurrencyConverter::convertBalance($amountInCents, $fromCurrency, $toCurrency);
67
+
68
+        return CurrencyConverter::prepareForMutator($convertedAmountInCents, $toCurrency);
67 69
     }
68 70
 
69 71
     /**

+ 10
- 21
app/Providers/MacroServiceProvider.php 查看文件

@@ -6,6 +6,7 @@ use Akaunting\Money\Currency;
6 6
 use Akaunting\Money\Money;
7 7
 use App\Models\Accounting\AccountSubtype;
8 8
 use App\Utilities\Accounting\AccountCode;
9
+use App\Utilities\Currency\CurrencyAccessor;
9 10
 use BackedEnum;
10 11
 use Closure;
11 12
 use Filament\Forms\Components\Field;
@@ -155,32 +156,20 @@ class MacroServiceProvider extends ServiceProvider
155 156
             return (int) round($convertedBalance);
156 157
         });
157 158
 
158
-        Money::macro('swapFormattedAmountFor', function ($newCurrency) {
159
-            $oldCurrency = $this->currency->getCurrency();
160
-            $balance = $this->getAmount();
161
-
162
-            $oldRate = currency($oldCurrency)->getRate();
163
-            $newRate = currency($newCurrency)->getRate();
164
-
165
-            $ratio = $newRate / $oldRate;
166
-
167
-            $convertedBalance = money($balance, $oldCurrency)->multiply($ratio)->getAmount();
168
-
169
-            return (int) filter_var($convertedBalance, FILTER_SANITIZE_NUMBER_INT);
170
-        });
171
-
172
-        Money::macro('formatWithCode', function () {
173
-            $formatted = $this->formatSimple();
174
-
175
-            $isSymbolFirst = $this->currency->isSymbolFirst();
159
+        Money::macro('formatWithCode', function (bool $codeBefore = false) {
160
+            $formatted = $this->format();
176 161
 
177 162
             $currencyCode = $this->currency->getCurrency();
178 163
 
179
-            if ($isSymbolFirst) {
180
-                return $formatted . ' ' . $currencyCode;
164
+            if ($currencyCode === CurrencyAccessor::getDefaultCurrency()) {
165
+                return $formatted;
166
+            }
167
+
168
+            if ($codeBefore) {
169
+                return $currencyCode . ' ' . $formatted;
181 170
             }
182 171
 
183
-            return $currencyCode . ' ' . $formatted;
172
+            return $formatted . ' ' . $currencyCode;
184 173
         });
185 174
 
186 175
         Currency::macro('getEntity', function () {

+ 7
- 4
app/Repositories/Accounting/JournalEntryRepository.php 查看文件

@@ -3,6 +3,8 @@
3 3
 namespace App\Repositories\Accounting;
4 4
 
5 5
 use App\Models\Accounting\Account;
6
+use Illuminate\Database\Eloquent\Builder;
7
+use Illuminate\Support\Carbon;
6 8
 
7 9
 class JournalEntryRepository
8 10
 {
@@ -11,12 +13,13 @@ class JournalEntryRepository
11 13
         $query = $account->journalEntries()->where('type', $type);
12 14
 
13 15
         if ($startDate && $endDate) {
14
-            $query->whereHas('transaction', static function ($query) use ($startDate, $endDate) {
15
-                $query->whereBetween('posted_at', [$startDate, $endDate]);
16
+            $endOfDay = Carbon::parse($endDate)->endOfDay();
17
+            $query->whereHas('transaction', static function (Builder $query) use ($startDate, $endOfDay) {
18
+                $query->whereBetween('posted_at', [$startDate, $endOfDay]);
16 19
             });
17 20
         } elseif ($startDate) {
18
-            $query->whereHas('transaction', static function ($query) use ($startDate) {
19
-                $query->where('posted_at', '<', $startDate);
21
+            $query->whereHas('transaction', static function (Builder $query) use ($startDate) {
22
+                $query->where('posted_at', '<=', $startDate);
20 23
             });
21 24
         }
22 25
 

+ 6
- 14
app/Utilities/Currency/CurrencyConverter.php 查看文件

@@ -4,26 +4,18 @@ namespace App\Utilities\Currency;
4 4
 
5 5
 class CurrencyConverter
6 6
 {
7
-    public static function convertAndSet($newCurrency, $oldCurrency, $amount): ?string
7
+    public static function convertBalance(int $balance, string $oldCurrency, string $newCurrency): int
8 8
     {
9
-        if ($newCurrency === null || $oldCurrency === $newCurrency) {
10
-            return null;
11
-        }
12
-
13
-        $old_attr = currency($oldCurrency);
14
-        $new_attr = currency($newCurrency);
15
-        $temp_balance = str_replace([$old_attr->getThousandsSeparator(), $old_attr->getDecimalMark()], ['', '.'], $amount);
16
-
17
-        return number_format((float) $temp_balance, $new_attr->getPrecision(), $new_attr->getDecimalMark(), $new_attr->getThousandsSeparator());
9
+        return money($balance, $oldCurrency)->swapAmountFor($newCurrency);
18 10
     }
19 11
 
20
-    public static function convertBalance($balance, $oldCurrency, $newCurrency): int
12
+    public static function prepareForMutator(int $balance, string $currency): string
21 13
     {
22
-        return money($balance, $oldCurrency)->swapAmountFor($newCurrency);
14
+        return money($balance, $currency)->formatSimple();
23 15
     }
24 16
 
25
-    public static function convertFormattedBalance($balance, $oldCurrency, $newCurrency): int
17
+    public static function prepareForAccessor(string $balance, string $currency): int
26 18
     {
27
-        return money($balance, $oldCurrency)->swapFormattedAmountFor($newCurrency);
19
+        return money($balance, $currency, true)->getAmount();
28 20
     }
29 21
 }

+ 31
- 10
app/ValueObjects/BalanceValue.php 查看文件

@@ -11,6 +11,8 @@ class BalanceValue
11 11
 
12 12
     private string $currency;
13 13
 
14
+    private ?int $convertedValue = null;
15
+
14 16
     public function __construct(int $value, string $currency)
15 17
     {
16 18
         $this->value = $value;
@@ -22,27 +24,46 @@ class BalanceValue
22 24
         return $this->value;
23 25
     }
24 26
 
27
+    public function getEffectiveValue(): int
28
+    {
29
+        return $this->convertedValue ?? $this->value;
30
+    }
31
+
32
+    public function getConvertedValue(): ?int
33
+    {
34
+        return $this->convertedValue;
35
+    }
36
+
37
+    public function getCurrency(): string
38
+    {
39
+        return $this->currency;
40
+    }
41
+
25 42
     public function formatted(): string
26 43
     {
27
-        return money($this->value, $this->currency)->format();
44
+        return money($this->getEffectiveValue(), $this->getCurrency())->format();
28 45
     }
29 46
 
30 47
     public function formattedSimple(): string
31 48
     {
32
-        return money($this->value, $this->currency)->formatSimple();
49
+        return money($this->getEffectiveValue(), $this->getCurrency())->formatSimple();
33 50
     }
34 51
 
35
-    public function formattedForDisplay(): string
52
+    public function formatWithCode(bool $codeBefore = false): string
36 53
     {
37
-        $defaultCurrency = CurrencyAccessor::getDefaultCurrency();
38
-        $accountCurrency = $this->currency;
54
+        return money($this->getEffectiveValue(), $this->getCurrency())->formatWithCode($codeBefore);
55
+    }
39 56
 
40
-        if ($accountCurrency === $defaultCurrency) {
41
-            return $this->formatted();
42
-        }
57
+    public function convert(): self
58
+    {
59
+        // The journal entry sums are stored in the default currency not the account currency (transaction amounts are stored in the account currency)
60
+        $fromCurrency = CurrencyAccessor::getDefaultCurrency();
61
+        $toCurrency = $this->currency;
43 62
 
44
-        $convertedBalance = CurrencyConverter::convertBalance($this->value, $defaultCurrency, $accountCurrency);
63
+        if ($fromCurrency !== $toCurrency) {
64
+            $this->convertedValue = CurrencyConverter::convertBalance($this->value, $fromCurrency, $toCurrency);
65
+        }
45 66
 
46
-        return money($convertedBalance, $accountCurrency)->formatWithCode();
67
+        return $this;
47 68
     }
48 69
 }

+ 36
- 35
composer.lock 查看文件

@@ -497,16 +497,16 @@
497 497
         },
498 498
         {
499 499
             "name": "aws/aws-sdk-php",
500
-            "version": "3.305.1",
500
+            "version": "3.305.3",
501 501
             "source": {
502 502
                 "type": "git",
503 503
                 "url": "https://github.com/aws/aws-sdk-php.git",
504
-                "reference": "3af1c6925b95a0f4303a1859dd56aa8374560c42"
504
+                "reference": "b190e24bd6568713436e1f13f9022bf28f491fc1"
505 505
             },
506 506
             "dist": {
507 507
                 "type": "zip",
508
-                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/3af1c6925b95a0f4303a1859dd56aa8374560c42",
509
-                "reference": "3af1c6925b95a0f4303a1859dd56aa8374560c42",
508
+                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/b190e24bd6568713436e1f13f9022bf28f491fc1",
509
+                "reference": "b190e24bd6568713436e1f13f9022bf28f491fc1",
510 510
                 "shasum": ""
511 511
             },
512 512
             "require": {
@@ -586,9 +586,9 @@
586 586
             "support": {
587 587
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
588 588
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
589
-                "source": "https://github.com/aws/aws-sdk-php/tree/3.305.1"
589
+                "source": "https://github.com/aws/aws-sdk-php/tree/3.305.3"
590 590
             },
591
-            "time": "2024-04-23T18:10:07+00:00"
591
+            "time": "2024-04-25T18:07:15+00:00"
592 592
         },
593 593
         {
594 594
             "name": "aws/aws-sdk-php-laravel",
@@ -1371,16 +1371,16 @@
1371 1371
         },
1372 1372
         {
1373 1373
             "name": "doctrine/dbal",
1374
-            "version": "3.8.3",
1374
+            "version": "3.8.4",
1375 1375
             "source": {
1376 1376
                 "type": "git",
1377 1377
                 "url": "https://github.com/doctrine/dbal.git",
1378
-                "reference": "db922ba9436b7b18a23d1653a0b41ff2369ca41c"
1378
+                "reference": "b05e48a745f722801f55408d0dbd8003b403dbbd"
1379 1379
             },
1380 1380
             "dist": {
1381 1381
                 "type": "zip",
1382
-                "url": "https://api.github.com/repos/doctrine/dbal/zipball/db922ba9436b7b18a23d1653a0b41ff2369ca41c",
1383
-                "reference": "db922ba9436b7b18a23d1653a0b41ff2369ca41c",
1382
+                "url": "https://api.github.com/repos/doctrine/dbal/zipball/b05e48a745f722801f55408d0dbd8003b403dbbd",
1383
+                "reference": "b05e48a745f722801f55408d0dbd8003b403dbbd",
1384 1384
                 "shasum": ""
1385 1385
             },
1386 1386
             "require": {
@@ -1464,7 +1464,7 @@
1464 1464
             ],
1465 1465
             "support": {
1466 1466
                 "issues": "https://github.com/doctrine/dbal/issues",
1467
-                "source": "https://github.com/doctrine/dbal/tree/3.8.3"
1467
+                "source": "https://github.com/doctrine/dbal/tree/3.8.4"
1468 1468
             },
1469 1469
             "funding": [
1470 1470
                 {
@@ -1480,7 +1480,7 @@
1480 1480
                     "type": "tidelift"
1481 1481
                 }
1482 1482
             ],
1483
-            "time": "2024-03-03T15:55:06+00:00"
1483
+            "time": "2024-04-25T07:04:44+00:00"
1484 1484
         },
1485 1485
         {
1486 1486
             "name": "doctrine/deprecations",
@@ -3542,16 +3542,16 @@
3542 3542
         },
3543 3543
         {
3544 3544
             "name": "laravel/socialite",
3545
-            "version": "v5.13.0",
3545
+            "version": "v5.13.1",
3546 3546
             "source": {
3547 3547
                 "type": "git",
3548 3548
                 "url": "https://github.com/laravel/socialite.git",
3549
-                "reference": "a03e9b2f63d8125f61952fe4f5b75d70fd7c8286"
3549
+                "reference": "feed1c1ccfd991bc12af59de4aa24f657d9c5cbe"
3550 3550
             },
3551 3551
             "dist": {
3552 3552
                 "type": "zip",
3553
-                "url": "https://api.github.com/repos/laravel/socialite/zipball/a03e9b2f63d8125f61952fe4f5b75d70fd7c8286",
3554
-                "reference": "a03e9b2f63d8125f61952fe4f5b75d70fd7c8286",
3553
+                "url": "https://api.github.com/repos/laravel/socialite/zipball/feed1c1ccfd991bc12af59de4aa24f657d9c5cbe",
3554
+                "reference": "feed1c1ccfd991bc12af59de4aa24f657d9c5cbe",
3555 3555
                 "shasum": ""
3556 3556
             },
3557 3557
             "require": {
@@ -3610,7 +3610,7 @@
3610 3610
                 "issues": "https://github.com/laravel/socialite/issues",
3611 3611
                 "source": "https://github.com/laravel/socialite"
3612 3612
             },
3613
-            "time": "2024-04-15T18:09:46+00:00"
3613
+            "time": "2024-04-24T20:36:50+00:00"
3614 3614
         },
3615 3615
         {
3616 3616
             "name": "laravel/tinker",
@@ -4412,16 +4412,16 @@
4412 4412
         },
4413 4413
         {
4414 4414
             "name": "livewire/livewire",
4415
-            "version": "v3.4.10",
4415
+            "version": "v3.4.11",
4416 4416
             "source": {
4417 4417
                 "type": "git",
4418 4418
                 "url": "https://github.com/livewire/livewire.git",
4419
-                "reference": "6f90e2d7f8e80a97a7406c22a0fbc61ca1256ed9"
4419
+                "reference": "8a78d0c3ae9b4c96a2d8932ea4ac0dc782325de0"
4420 4420
             },
4421 4421
             "dist": {
4422 4422
                 "type": "zip",
4423
-                "url": "https://api.github.com/repos/livewire/livewire/zipball/6f90e2d7f8e80a97a7406c22a0fbc61ca1256ed9",
4424
-                "reference": "6f90e2d7f8e80a97a7406c22a0fbc61ca1256ed9",
4423
+                "url": "https://api.github.com/repos/livewire/livewire/zipball/8a78d0c3ae9b4c96a2d8932ea4ac0dc782325de0",
4424
+                "reference": "8a78d0c3ae9b4c96a2d8932ea4ac0dc782325de0",
4425 4425
                 "shasum": ""
4426 4426
             },
4427 4427
             "require": {
@@ -4476,7 +4476,7 @@
4476 4476
             "description": "A front-end framework for Laravel.",
4477 4477
             "support": {
4478 4478
                 "issues": "https://github.com/livewire/livewire/issues",
4479
-                "source": "https://github.com/livewire/livewire/tree/v3.4.10"
4479
+                "source": "https://github.com/livewire/livewire/tree/v3.4.11"
4480 4480
             },
4481 4481
             "funding": [
4482 4482
                 {
@@ -4484,7 +4484,7 @@
4484 4484
                     "type": "github"
4485 4485
                 }
4486 4486
             ],
4487
-            "time": "2024-04-02T14:22:50+00:00"
4487
+            "time": "2024-04-24T12:14:15+00:00"
4488 4488
         },
4489 4489
         {
4490 4490
             "name": "masterminds/html5",
@@ -10636,16 +10636,16 @@
10636 10636
         },
10637 10637
         {
10638 10638
             "name": "phpunit/phpunit",
10639
-            "version": "10.5.19",
10639
+            "version": "10.5.20",
10640 10640
             "source": {
10641 10641
                 "type": "git",
10642 10642
                 "url": "https://github.com/sebastianbergmann/phpunit.git",
10643
-                "reference": "c726f0de022368f6ed103e452a765d3304a996a4"
10643
+                "reference": "547d314dc24ec1e177720d45c6263fb226cc2ae3"
10644 10644
             },
10645 10645
             "dist": {
10646 10646
                 "type": "zip",
10647
-                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c726f0de022368f6ed103e452a765d3304a996a4",
10648
-                "reference": "c726f0de022368f6ed103e452a765d3304a996a4",
10647
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/547d314dc24ec1e177720d45c6263fb226cc2ae3",
10648
+                "reference": "547d314dc24ec1e177720d45c6263fb226cc2ae3",
10649 10649
                 "shasum": ""
10650 10650
             },
10651 10651
             "require": {
@@ -10717,7 +10717,7 @@
10717 10717
             "support": {
10718 10718
                 "issues": "https://github.com/sebastianbergmann/phpunit/issues",
10719 10719
                 "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
10720
-                "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.19"
10720
+                "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.20"
10721 10721
             },
10722 10722
             "funding": [
10723 10723
                 {
@@ -10733,7 +10733,7 @@
10733 10733
                     "type": "tidelift"
10734 10734
                 }
10735 10735
             ],
10736
-            "time": "2024-04-17T14:06:18+00:00"
10736
+            "time": "2024-04-24T06:32:35+00:00"
10737 10737
         },
10738 10738
         {
10739 10739
             "name": "sebastian/cli-parser",
@@ -11653,16 +11653,16 @@
11653 11653
         },
11654 11654
         {
11655 11655
             "name": "spatie/backtrace",
11656
-            "version": "1.5.3",
11656
+            "version": "1.6.1",
11657 11657
             "source": {
11658 11658
                 "type": "git",
11659 11659
                 "url": "https://github.com/spatie/backtrace.git",
11660
-                "reference": "483f76a82964a0431aa836b6ed0edde0c248e3ab"
11660
+                "reference": "8373b9d51638292e3bfd736a9c19a654111b4a23"
11661 11661
             },
11662 11662
             "dist": {
11663 11663
                 "type": "zip",
11664
-                "url": "https://api.github.com/repos/spatie/backtrace/zipball/483f76a82964a0431aa836b6ed0edde0c248e3ab",
11665
-                "reference": "483f76a82964a0431aa836b6ed0edde0c248e3ab",
11664
+                "url": "https://api.github.com/repos/spatie/backtrace/zipball/8373b9d51638292e3bfd736a9c19a654111b4a23",
11665
+                "reference": "8373b9d51638292e3bfd736a9c19a654111b4a23",
11666 11666
                 "shasum": ""
11667 11667
             },
11668 11668
             "require": {
@@ -11670,6 +11670,7 @@
11670 11670
             },
11671 11671
             "require-dev": {
11672 11672
                 "ext-json": "*",
11673
+                "laravel/serializable-closure": "^1.3",
11673 11674
                 "phpunit/phpunit": "^9.3",
11674 11675
                 "spatie/phpunit-snapshot-assertions": "^4.2",
11675 11676
                 "symfony/var-dumper": "^5.1"
@@ -11699,7 +11700,7 @@
11699 11700
                 "spatie"
11700 11701
             ],
11701 11702
             "support": {
11702
-                "source": "https://github.com/spatie/backtrace/tree/1.5.3"
11703
+                "source": "https://github.com/spatie/backtrace/tree/1.6.1"
11703 11704
             },
11704 11705
             "funding": [
11705 11706
                 {
@@ -11711,7 +11712,7 @@
11711 11712
                     "type": "other"
11712 11713
                 }
11713 11714
             ],
11714
-            "time": "2023-06-28T12:59:17+00:00"
11715
+            "time": "2024-04-24T13:22:11+00:00"
11715 11716
         },
11716 11717
         {
11717 11718
             "name": "spatie/flare-client-php",

+ 6
- 6
package-lock.json 查看文件

@@ -1079,9 +1079,9 @@
1079 1079
             "dev": true
1080 1080
         },
1081 1081
         "node_modules/electron-to-chromium": {
1082
-            "version": "1.4.747",
1083
-            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.747.tgz",
1084
-            "integrity": "sha512-+FnSWZIAvFHbsNVmUxhEqWiaOiPMcfum1GQzlWCg/wLigVtshOsjXHyEFfmt6cFK6+HkS3QOJBv6/3OPumbBfw==",
1082
+            "version": "1.4.749",
1083
+            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.749.tgz",
1084
+            "integrity": "sha512-LRMMrM9ITOvue0PoBrvNIraVmuDbJV5QC9ierz/z5VilMdPOVMjOtpICNld3PuXuTZ3CHH/UPxX9gHhAPwi+0Q==",
1085 1085
             "dev": true
1086 1086
         },
1087 1087
         "node_modules/emoji-regex": {
@@ -1467,9 +1467,9 @@
1467 1467
             "dev": true
1468 1468
         },
1469 1469
         "node_modules/lru-cache": {
1470
-            "version": "10.2.0",
1471
-            "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.0.tgz",
1472
-            "integrity": "sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==",
1470
+            "version": "10.2.1",
1471
+            "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.1.tgz",
1472
+            "integrity": "sha512-tS24spDe/zXhWbNPErCHs/AGOzbKGHT+ybSBqmdLm8WZ1xXLWvH8Qn71QPAlqVhd0qUTWjy+Kl9JmISgDdEjsA==",
1473 1473
             "dev": true,
1474 1474
             "engines": {
1475 1475
                 "node": "14 || >=16.14"

+ 1
- 1
resources/views/livewire/company/service/connected-account/list-institutions.blade.php 查看文件

@@ -56,7 +56,7 @@
56 56
 
57 57
                             @if($account?->ending_balance)
58 58
                                 <div class="account-balance flex text-base leading-6 text-gray-700 dark:text-gray-200 space-x-1">
59
-                                    <strong wire:poll.visible>{{ $account->ending_balance }}</strong>
59
+                                    <strong wire:poll.visible>{{ $account->ending_balance->formatted() }}</strong>
60 60
                                     <p>{{ $account->currency_code }}</p>
61 61
                                 </div>
62 62
                             @endif

Loading…
取消
儲存