use request methods in websocket data #1566
Answered
by
farshadfahimi
farshadfahimi
asked this question in
Help
-
I have an event like below for store the new resource in database const brand = await Brand.create({
name: data.name,
name_en: data.name_en
}) I like to do this like what I do in the request like below const brand = await Brand.create(request.only(['name', 'name_en'])) I want to know is there any way to user |
Beta Was this translation helpful? Give feedback.
Answered by
farshadfahimi
Sep 7, 2020
Replies: 1 comment
-
As I research on the /**
* Returns value for only given keys.
*
* @method only
*
* @param {Array} keys
*
* @return {Object}
*
* @example
* ```js
* request.only(['username', 'age'])
* ```
*/
only (keys) {
return _.pick(this.all(), keys)
} so I can do this with lodash |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
farshadfahimi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As I research on the
Request
class I found adonis use lodashpick
methodlike below
so I can do this with lodash
pick