Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

adonisjs findorcreate

import User from 'App/Models/User'

const searchPayload = { email: 'virk@adonisjs.com' }
const savePayload = { password: 'secret' }

await User.firstOrCreate(searchPayload, savePayload)
Source by docs.adonisjs.com #
 
PREVIOUS NEXT
Tagged: #adonisjs #findorcreate
ADD COMMENT
Topic
Name
2+2 =