whisper-money/app
Víctor Falcón 7784f0d4fb
refactor(banks): add Bank::availableForUser scope (#480)
## What

The "public banks + user's own banks" query was repeated in **5
controllers** (Transaction ×2, Settings/Bank, Budget, Cashflow,
Onboarding).

New `Bank::availableForUser($user)` scope; all 5 sites use it.

Bonus: the Onboarding variant had no `where()` grouping around
`whereNull/orWhere` — harmless today (no other constraints) but a latent
precedence bug. The scope always groups.

## Stats

- **-31 / +24 lines**, 5 call sites → 1 definition

## Checks

- `php artisan test
--filter="Bank|Transaction|Budget|Cashflow|Onboarding"` — 612 passed
(2707 assertions), 1 skipped
- `vendor/bin/pint --dirty` — pass

Part of duplication-removal series (#475–#479).
2026-06-03 17:59:24 +02:00
..
Actions fix(register): don't block signup on unrecognized browser timezone (#462) 2026-06-01 09:03:15 +02:00
Console/Commands feat(discord): enrich Stripe event messages and dedupe deliveries (#460) 2026-05-31 12:50:37 +02:00
Contracts feat(banking): add banking:backfill-ibans command to populate missing IBANs (#221) 2026-03-12 10:58:55 +00:00
Enums feat(cashflow): add savings and period views (#424) 2026-05-25 16:41:00 +02:00
Events Add Budgeting Feature to Track and Manage Spending (#36) 2026-01-21 15:25:50 +01:00
Exceptions/Banking Handle transient EnableBanking sync failures (#358) 2026-05-06 09:24:05 +02:00
Features feat(import): calculate balances from transactions (#403) 2026-05-20 10:29:14 +01:00
Http refactor(banks): add Bank::availableForUser scope (#480) 2026-06-03 17:59:24 +02:00
Jobs feat(settings): let users disable bank transactions email (#472) 2026-06-02 12:24:39 +02:00
Listeners feat(discord): enrich Stripe event messages and dedupe deliveries (#460) 2026-05-31 12:50:37 +02:00
Mail feat(leads): add user lead re-invite campaign (#432) 2026-05-26 08:35:31 +02:00
Models refactor(banks): add Bank::availableForUser scope (#480) 2026-06-03 17:59:24 +02:00
Notifications feat: selective retry of failed lead email jobs (#286) 2026-04-15 08:00:29 +01:00
Policies refactor(policies): extract HandlesUserOwnership trait (#478) 2026-06-03 17:43:30 +02:00
Providers feat: add Discord admin feed for daily stats and Stripe events (#458) 2026-05-30 18:14:46 +02:00
Services feat(budgets): track multiple categories and labels per budget (#466) 2026-06-01 12:32:23 +02:00