Skip to content

Instance Method

attach(_:method:on:_:)

Attach a single model by creating a pivot model and specifying the attachment method.
func attach(_ to: To, method: SiblingsProperty<From, To, Through>.AttachMethod, on database: any Database, _ edit: @escaping @Sendable (Through) -> () = { _ in }) -> EventLoopFuture<Void>

Parameters

to

The model to attach through a sibling releationship

method

The attachment method to use when deciding whether to create the pivot.

database

The database to perform the attachment on.

edit

An optional closure to edit the pivot model before saving it.