You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the feature as you'd like to see it
There are situations where you might want to filter certain conditions in pivot table in-case of many-to-many relationships. There doesn't seems to have this feature in ORM.
What do we currently have to do now?
We have to actually add that feature. The idea is as below:
classUser(Model):
__table__="users"classRole(Model):
__table__="roles"@belongs_to_manydefusers(self):
returnUser.where_pivot("approved", True)
# imagine there's a pivot table `role_user` with following schemawithself.schema.create('role_user') astable:
table.unsigned_integer("role_id")
table.unsigned_integer("user_id")
table.boolean("approved").default(False)
This doesn't seems to be a breaking change, this should just add one extra feature
The text was updated successfully, but these errors were encountered:
tara-aibot
changed the title
Add ability to query pivot columns in many to many relationship.
Add ability to query pivot columns in many to many relationship. [enhancement](https://app.tara.ai/8/*/tasks/masonite-x-inc) #p
Jul 2, 2022
tara-aibot
changed the title
Add ability to query pivot columns in many to many relationship. [enhancement](https://app.tara.ai/8/*/tasks/masonite-x-inc) #p
Add ability to query pivot columns in many to many relationship. [enhancement](https://app.tara.ai/8/*/tasks/masonite-x-inc) [P2](https://app.tara.ai/8/*/tasks/masonite-x-inc)
Jul 2, 2022
josephmancuso
changed the title
Add ability to query pivot columns in many to many relationship. [enhancement](https://app.tara.ai/8/*/tasks/masonite-x-inc) [P2](https://app.tara.ai/8/*/tasks/masonite-x-inc)
Add ability to query pivot columns in many to many relationship.
Jul 4, 2022
Pretty sure we can just do Model.where("role_user.approved", True) since belongs to many is doing a join. If thats not a good a solution we can reopen this
Describe the feature as you'd like to see it
There are situations where you might want to filter certain conditions in pivot table in-case of many-to-many relationships. There doesn't seems to have this feature in ORM.
What do we currently have to do now?
We have to actually add that feature. The idea is as below:
The text was updated successfully, but these errors were encountered: