Laravel many-to-many association filtering

there are requirements in the

project:
A user may have multiple positions, and there is a filtering mechanism in the user list page, which should be filtered according to the positions selected by the user;

users: user table
posts: position table
user_post: user position middle table

there may be many filters, and their relationships are all defined in the model, but how to write these complex filters gracefully

Jun.07,2022

whereHas

Menu