In my application, I updated the relationship from one-to-many to many-to-many , and I'm trying to figure out a way to save related functions.
Let's say I have two related tables, for example. dogs and owners. If I have an array of owners and I try to get a list of dog identifiers for these owners, how should I do it eloquently?
A similar question was asked here: https://laracasts.com/discuss/channels/laravel/getting-many-to-many-related-data-for-an-array-of-elements
So, how do I get Dog models where Owner is in an array?
Same as $associatedDogs = Dog::whereIn('owner_id',$ListOfOwners)->get(); for a one-to-many relationship, but for many-to-many .
laravel many-to-many laravel-eloquent
Angelin calu
source share