Exclude users if a user relationship exists

Posted 4 weeks ago by Kunzilla

Hi there, i build a small social platform where a user can "follow" a user. I've created a "relation" table with the user ids (A->B, B->A). Now i want to suggest users some other users to follow them. But how can i exclude following users from my query?

User::where('verified', true)->limit($limit)->get();

I tryed it with:

doesntHave('relation')

Hope you can help! Thanks!

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.