mirror of
https://github.com/namibia/awesome-cheatsheets.git
synced 2024-12-18 08:34:06 +00:00
docs(adonis): add callback to attach method
This commit is contained in:
parent
9025748f03
commit
62efe852d1
@ -279,8 +279,8 @@ instance.delete() // Delete model instance from the d
|
|||||||
|
|
||||||
instance.associate(id) // Exclusive to belongsTo relationship, where it associates two model instances together.
|
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.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.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([id, id...]) // The opposite of the attach method, and it removes the relationship from the pivot table only.
|
instance.detach(arrayOfIds) // The opposite of the attach method, and it removes the relationship from the pivot table only.
|
||||||
|
|
||||||
/********************************************************************************************
|
/********************************************************************************************
|
||||||
* QUERY BUILDER
|
* QUERY BUILDER
|
||||||
|
Loading…
Reference in New Issue
Block a user