mercredi 24 janvier 2018

Get objects in the other part of a N-N relationship that are not related to the actual object

I have a N-N relationship between Films and Genres, and I am trying to get from a $film the objects in the table Genres that are NOT in $film->genres().

I have looked for trying to do something like Genres:all() - $film->genres() or to do a loop in order to erase everyone but there is no Collection method that allows me to do that.

How can I do that?

Thanks.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire