Skip to content

[14.x] feat: support subqueries in whereKey - #61496

Merged
taylorotwell merged 1 commit into
laravel:masterfrom
calebdw:calebdw/push-lmxuutmntyuo
Sep 9, 2026
Merged

[14.x] feat: support subqueries in whereKey#61496
taylorotwell merged 1 commit into
laravel:masterfrom
calebdw:calebdw/push-lmxuutmntyuo

Conversation

@calebdw

@calebdw calebdw commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Hello!

This add subquery support to whereKey and all related methods!

Thanks!

@taylorotwell

Copy link
Copy Markdown
Member

Hm, when would you need this?

@calebdw

calebdw commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

There's been a couple of cases where we've fallen back to using whereIn('id', ...) because whereKey did not support it

here's an example of the most recent snippet I came across that motivated this PR

            'users' => User::query()
                ->whereIn('id', Accounting::query()
                    ->select('created_by')
                    ->whereNotNull('created_by')
                    ->distinct())
                // ...

@taylorotwell
taylorotwell merged commit 497b62f into laravel:master Sep 9, 2026
48 checks passed
@calebdw
calebdw deleted the calebdw/push-lmxuutmntyuo branch September 9, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants