Pivot model can't have belongsToMany other model #32987
-
Description:I have a model Article and a model Site. I also have a combined model ArticleSite (pivot). I also have a model Dossier (these are kinds op tags you can attach to an ArticleSite). So, I needed a many-2-many between Dossier and ArticleSite. When I manually insert some records into my database, I can fetch the Dossiers linked to ArticleSite within an collection, but saving keeps getting errors, like: Steps To Reproduce:ArticleSite pivot model:
Dossier model
I have a simple function in my web file to test the functionality:
This works fine. What does not work, is this:
I skipped some fields for readabilty. The following line results in the error I posted earlier. I also tried the sync method. I tried defining the fields on the relation, but i keeps posting a null value and empty column name. Is this a bug or I am implementing it incorrectly? EDIT:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Ok, I solved it. to Feels kind of odd though... |
Beta Was this translation helpful? Give feedback.
Ok, I solved it.
I just changed
class ArticleSite extends Pivot
to
class ArticleSite extends Model
Feels kind of odd though...