Unable to create pivot tables with attributes
Opened this issue · 0 comments
alar77 commented
In line 91 of Processor/RelationProcessor a table is recognized as pivotat for a many to many relations (and then included as belongToMany) only if it only has 2 columns.
This makes impossible to store attributes on relation:
if (count($foreignKeys) === 2 && (count($table->getColumns()) === 2))
What about considering a table pivot also if it has exactly 2 primary keys like in
if (count($foreignKeys) === 2 && (count($table->getColumns()) === 2) or count($primaryKeys)===2)) {
Also, maybe the created_at and updated_at columns could be ignored and not counted