bosnadev / repository

Laravel Repositories is a package for Laravel 5 which is used to abstract the database layer. This makes applications much easier to maintain.

Home Page:https://bosnadev.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What's the proper way to create criteria with pivot tables?

casenjo opened this issue · comments

I have a table, A, which has a many-to-many relationship with two other tables, B and C, via their respective pivot tables.

My model for A has a method which returns a BelongsToMany relation for table B. How can I use that when I'm building a criteria to find specific results?

Ex: I want to get all of the rows of table A that have a specific value of B in the pivot table

+1 Curious as well