Closed utherp closed 10 months ago
...I probably should have put this in discussions first.
Hi @utherp, No worries.
Pass the name of the table to withPivot()
:
$obj->permitted_through_sets()->withPivot('TODO', ['target_id'])
^^^^
I did finally find the solution... I presumed the same signature as laravel's. thanks, this module is awesome! saves me so much extra b.s.
I'm using hasManyDeepFromRelations, 2 deep, both with morphToMany: assume all classes use Permissible and extend Model with the below code:
when I call permitted_by through a Set in tinker, I get this:
but when I call permitted_through_sets, I get this:
I don't get the pivot object, which is kind of important. I tried adding a call to withPivot, this is what it returned:
I just get a blank Pivot object on the property of the column name, rather than how it is normally returned, as a pivot object on the pivot property.
I do realize that the pivot may be ambiguous, but it should return at least the last pivot.