topclaudy / compoships

Multi-columns relationships for Laravel's Eloquent ORM
MIT License
1.12k stars 132 forks source link

Does compoships support multiple columns using fieldnames and values? #89

Closed qlj closed 4 years ago

qlj commented 4 years ago

I've briefly read the documentation, and you extend hasOne() or hasMany() by matching tables by their field-names.

I have a situation where one of my tables contains the fields:

Would compoships support something like:

$this->hasOne( 'App\Models\Address', [ 'fk_id', someusefulhelper('fk_table') ], ['id', 'customers'] );

?

topclaudy commented 4 years ago

For situation like this, I suggest the use of where clauses in the definition of the relationships.