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
{{ message }}
This repository has been archived by the owner on Jul 16, 2021. It is now read-only.
Using a hasOne, hasMany and belongsTo, I can configure every column name involved into the relationship, both the current table column name and the related table column name using extra optional parameters.
e.g. the constructor of HasOneOrMany relationship accepts a lot of parameters
Using belongsToMany this configurability is not available. If the current table doesn't use primary key as join column with pivot table, I cannot use this relationship (unless force a runtime change of primaryKey property).
e.g.
users table
- id : primary
- email
roles table
- id : primary
- name
role_user
- user_email
- role_id
I used to work with a lot of legacy db, and I found this feature very useful. I've got to implement this behavior a lot of time using different approaches, based on the different contexts.
If you think that having more optional parameters on BelongsToMany will be a good idea, i could implement and test a more abstract approach to allow everyone to use this.
The text was updated successfully, but these errors were encountered:
alberto-bottarini
changed the title
[Proposal] Configurability of foreign keys using a BelongsToMany relationship
[Proposal] Configurability of column name using a BelongsToMany relationship
Feb 7, 2017
alberto-bottarini
changed the title
[Proposal] Configurability of column name using a BelongsToMany relationship
[Proposal] Configurability of key column names using a BelongsToMany relationship
Feb 7, 2017
If you have a working state send a PR to master. Taylor reviews PRs faster than internals discussion.
It simply can't go into an existing version since it is a BC break. But, if Taylor will allow it to work it can get added into future releases of 5.x most likely.
Using a hasOne, hasMany and belongsTo, I can configure every column name involved into the relationship, both the current table column name and the related table column name using extra optional parameters.
e.g. the constructor of HasOneOrMany relationship accepts a lot of parameters
Using belongsToMany this configurability is not available. If the current table doesn't use primary key as join column with pivot table, I cannot use this relationship (unless force a runtime change of primaryKey property).
e.g.
I used to work with a lot of legacy db, and I found this feature very useful. I've got to implement this behavior a lot of time using different approaches, based on the different contexts.
If you think that having more optional parameters on BelongsToMany will be a good idea, i could implement and test a more abstract approach to allow everyone to use this.
The text was updated successfully, but these errors were encountered: