docs(adonis): add callback to attach method

This commit is contained in:
Julien Le Coupanec 2020-07-22 10:07:50 +02:00
parent 9025748f03
commit 62efe852d1
1 changed files with 4 additions and 4 deletions

View File

@ -277,10 +277,10 @@ instance.merge(jsonAttributes) // Modifies the specified attribute
instance.save() // Save the instance to the database.
instance.delete() // Delete model instance from the database.
instance.associate(id) // Exclusive to belongsTo relationship, where it associates two model instances together.
instance.dissociate(id) // The opposite of associate, where you just drop the relationship
instance.attach([id, id...]) // Works with the belongsToMany relationship to attach a relationship inside the pivot table.
instance.detach([id, id...]) // The opposite of the attach method, and it removes the relationship from the pivot table only.
instance.associate(id) // Exclusive to belongsTo relationship, where it associates two model instances together.
instance.dissociate(id) // The opposite of associate, where you just drop the relationship
instance.attach(arrayOfIds, callback) // Works with the belongsToMany relationship to attach a relationship inside the pivot table. The attach method accepts an optional callback receiving the pivotModel instance, allowing you to set extra properties on a pivot table if required:
instance.detach(arrayOfIds) // The opposite of the attach method, and it removes the relationship from the pivot table only.
/********************************************************************************************
* QUERY BUILDER