Replies: 2 comments 4 replies
-
do you need order services or categories in each services? |
Beta Was this translation helpful? Give feedback.
2 replies
-
The second argument of preload is a callback function that's provided the query builder for the relationship: So, with that in mind, you can do something like the following: const services = await Service
.query()
.preload('categories', query => query.orderBy('id', 'desc')) // <- anything done in the callback will apply to the categories query. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have implement the following query in adonisjs v4 :
It's work fine.
how to implement the relation column order_by in adonis v5 preload() relation.
Beta Was this translation helpful? Give feedback.
All reactions