Skip to content

where based on nested field #3218

Answered by thetutlage
leognmotta asked this question in Help
Discussion options

You must be logged in to vote

We have a dedicated section for this in the docs https://docs.adonisjs.com/guides/models/relationships#filter-by-relationships. Give it a read and let me know if you have any questions.

A quick note

  • The preload method loads the related data
  • The has and whereHas methods are used for filtering the top level results based upon a relationship. This is what you need

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@leognmotta
Comment options

Answer selected by leognmotta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants