Skip to content
Advertisement

Delete unused groups in Laravel 8

I have a group model and I want to delete groups that don’t have any member.

How can I get empty groups with eloquent or SQL query ?

And this is the User model code:

Advertisement

Answer

I think whereDoesntHave work in you situation.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement