baethon/kex

Add whereHas for checking the relations

radmen opened this issue · 0 comments

It would be nice to have a whereHas method which checks if the model has given relation.

await User.query()
  .whereHas('Message')

would result in the following query:

select * from users where exists (
  select * from messages where messages.user_id = users.id
)