Skip to content

Instance Method

join(from:siblings:)

This will join the foreign table based on a @Siblingsrelation This will result in joining two tables. The Pivot table and the wanted model table
@discardableResult func join<From, To, Through>(from model: From.Type, siblings: KeyPath<From, SiblingsProperty<From, To, Through>>) -> Self where From : Model, To : Model, Through : Model

Parameters

model

The Model to join form

siblings

The SiblingsProperty to join

Return Value

A new QueryBuilder

Discussion

This will not decode the joined data, but can be used in order to filter.

Star.query(on: db)
    .join(from: Star.self, siblings: \.$tags)
    .filter(Tag.self, \Tag.$name == "Something")