Skip to content

Instance Method

join(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<To, Through>(siblings: KeyPath<Model, SiblingsProperty<Model, To, Through>>) -> Self where To : Model, Through : Model

Parameters

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(siblings: \.$tags)
    .filter(Tag.self, \Tag.$name == "Something")