Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

You can make your pivot table look like anything you want. I'm not sure I understand this question.

Last updated 2 years ago.
0

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 :)

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

asmerkin asmerkin Joined 4 Jun 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.