Update array of models at once using .merge function #3930
Answered
by
tomgobich
3adel-bassiony
asked this question in
Help
-
Hello
I know I can use for loop but I'm asking if there is something better to update the array at once |
Beta Was this translation helpful? Give feedback.
Answered by
tomgobich
Oct 19, 2022
Replies: 1 comment 2 replies
-
You can do this all in one call using the await Item.query().where('name', 'test').update({ deletedAt: DateTime.now() }) https://docs.adonisjs.com/guides/models/crud-operations#update |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
3adel-bassiony
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can do this all in one call using the
update
method on the query.https://docs.adonisjs.com/guides/models/crud-operations#update