How Reliable is to create a new class to override the default MorphToMany implementation? This way i could tell Laravel to use a custom MorphPivot with the functionality i want.
You can make your pivot table look like anything you want. I'm not sure I understand this question.
The problem is that the pivot table for a normal belongsToMany and for a morphMany are fetched from different places. The normal one is being fetched from Model.php, but the polymorphic one is being fetched inside the MorphMany class.
I solved it using a normal belongsToMany relationship with a custom where that matches with the $name_type.
It works fine now :)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community