How do I use a polymorphic many-to-many relationship in Laravel 4.1? -
As an example of this question, let me use TV shows, movies, and actors. Each TV show and movie has many artists and each actor is in one or more TV shows and / or movies. If I established a polymorphous multiple-to-many relationship between them, it seems that I have all of my TV shows and separately for all of my film, but despite all the googling I can come up with one Actor can do the query, I have not met an actor's TV show and / or a way to query for the union of all of the movie in a collection. Is not this useful to many polycentric relationships?
If it turns out that it is actually possible, then perhaps I will add notes to the table and model setup to achieve it because I'm not able to work it yet. If this is not possible, can you help me understand this kind of relationship because I do not understand it clearly. I feel that without this question, I do not get anything to use two very many relationships.
I'm not sure that this will solve your question, but you can use a single archive
You can also like them: This will return a collection of movies and TV shows. To make life easier, make follow-up celebrations in your actor category Hope that helps
Actors :: find (1) -> gt; ; Film-> Merge (Actor: Find (1) -> tv_shows);
Public Function TV EndMovies () {Returns Self :: Movies- & gt; Merge (auto :: Tv_show); }
Comments
Post a Comment