diff --git a/src/masoniteorm/relationships/HasManyThrough.py b/src/masoniteorm/relationships/HasManyThrough.py index 52460314..86174cfb 100644 --- a/src/masoniteorm/relationships/HasManyThrough.py +++ b/src/masoniteorm/relationships/HasManyThrough.py @@ -81,7 +81,7 @@ def apply_query(self, distant_builder, intermediary_builder, owner): f"{self.intermediary_builder.get_table_name()}.{self.foreign_key}", "=", f"{distant_builder.get_table_name()}.{self.other_owner_key}", - ).get() + ).where(f"{self.intermediary_builder.get_table_name()}.{self.local_owner_key}", getattr(owner, self.other_owner_key)).get() return result