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

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c0827b-53f69.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c0827b-53f69.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?