I'm using simple table inheritance with Laravel (using a plugin like Nanigans/single-table-inheritance or intrip/laravel-single-table-inheritance but I can also implement my own one, that isn't the problem).
I'm also using belongsToMany relations: A book can has many words and a word can be in many books.
Imagine that I have something like:
Book {
verbs() { belongsToMany ('Verb',...) }
adjectives() { belongsToMany ('Adjective',...) }
}
And also image that 'verb' and 'adjective' are sharing the table 'words' with different 'type' field and extending a model 'Word'.
The problem is when I'm using sync() (like $book->verbs()->sync([1,2,3])) is also clearing the adjectives relations when it shouldn't.
Do you know any solution?