Closed kaydenvanrijn closed 1 year ago
I'll take a look.
By default, the pivot accessor should be 'pivot', rather than the model's name
This would be a breaking change for existing users.
Instead of having to pass both the table and the class, one should only have to pass a pivot parameter which would be the class name (e.g UserContact::class)
That's what withIntermediate()
does. withPivot()
is the generic method that also supports cases where it can't resolve the table name from the class.
https://github.com/staudenmeir/eloquent-has-many-deep/blob/81d2d7304949416d6f5a4ab6d00cc07524d07129/src/RetrievesIntermediateTables.php#L45
Feature request to match Eloquent:
table
and theclass
, one should only have to pass apivot
parameter which would be the class name (e.gUserContact::class
)(new Pivot())->getTable()
Here's the current way to do it:
Here's my requested way of doing it: