nova-order-field
nova-order-field copied to clipboard
Relations conflict on the same model
Hi, guys! Your package is awesome. But I've got an error.
I have a model that should be orderable within BelongsTo
and BelongsToMany
relations at the same time.
So, my Nova resource uses Orderable, HasOrderablePivot
. When I am going to page with BelongsTo
relation I am getting an error:
Call to undefined method Illuminate\Database\Eloquent\Relations\HasMany::getPivotClass()
The fix is very easy, just to check the type of $realtion
in HasOrderablePivot::orderedManyPivotModel()
if(
!$relationship ||
!$relationship instanceof BelongsToMany ||
!$relationship->getPivotClass()
) {
return;
}
It works fine for me. Waiting for your answer :smiley: