#Get single relation for many to many (polymorphic )
8 messages · Page 1 of 1 (latest)
No, morph to doesn't work
So, what exactly "doesn't work"? You're using a many relation, so that wouldn't return a single role. And if you have a many-to-many, you can just change that to a many-to-one or one-to-one.
The problem that I need pivot polymorphic table and user should have only one role. Could you please provide an example how can I use morphTo in my case?
Role is an abstract model, I use in real project it, where a lot of models can use it. By this reason I use polymorphic relation
This is not for my case, because one Role I want use for many models. Only problem that laravel doesnt have morphToOne