whisper-money/app/Http
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
..
Controllers refactor(banks): add Bank::availableForUser scope (#480) 2026-06-03 17:59:24 +02:00
Middleware feat: keep past due subscriptions active (#416) 2026-05-22 10:19:11 +01:00
Requests refactor(requests): share category cashflow direction resolution (#479) 2026-06-03 17:39:40 +02:00
Responses fix: route new PWA guests to signup (#313) 2026-04-21 10:53:05 +01:00