From 62efe852d1f62d2ed1f38544e4a5ffa04a69ff5a Mon Sep 17 00:00:00 2001 From: Julien Le Coupanec Date: Wed, 22 Jul 2020 10:07:50 +0200 Subject: [PATCH] docs(adonis): add callback to attach method --- backend/adonis.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/adonis.js b/backend/adonis.js index 7f9c9bc..62eb1ab 100644 --- a/backend/adonis.js +++ b/backend/adonis.js @@ -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