Add whereHas for checking the relations
radmen opened this issue · 0 comments
radmen commented
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
)