I simply can't wrap my head
When a pb is too big, just decompose it in smaller pats.
... and share some code.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello.
I'm trying to make a query where I pull 10 users randomly, but they cannot exist with certain IDs in a table of lifestyle choices, they also cannot exist in a table of blocked users. The amount of IDs that should be filtered is unknown, so it should be some kind of array where multiple values are checked. So a user should be able to get shown random users, but without seeing, for example, smokers, and also not any blocked users.
I've tried all day since friday but I simply can't wrap my head around how the query should be constructed. I want to construct this advanced query as a challenge, I will make it happen I just don't have enough experience to pull it off. I've tried a few combinations and my best guess would be multiple ->whereNotIn for blocked and lifestyle tables but it's a bit complicated for me to fully make.
Please or to participate in this conversation.