Querying related items in multiple relationshipCreated 11 months ago by emergingdzns
I’ve got a stream called Threads. Inside of Threads I have a multiple relationship called
participants that is related to the
In my controller, I’m trying to make a simple call to get all of the threads a user is added to as a
I’m tying my brain up in knots because it’s sort of backwards from the normal approach. I could add a field to the users table in the admin panel that is a multiple relationship to the threads table and then query from there but I don’t feel that’s the appropriate way to do it because it removes the pivot table from the picture and then I have the same problem in reverse if I need to get all users for a given thread.
I was thinking maybe I need to bind to the user model in the module service provider but the problem is that the threads_participants table has no actual model so I’m getting confused as to how to bind in a way that lets me do something like this:
$threads = $user->threads;
It’s probably something simple that I’m not seeing but I’m getting stuck on this.
I appreciate any help you can offer.