In Eloquent, you can combine whereHas()
and orDoesntHave()
in one sentence.
User::whereHas('roles', function($query) { $query->where('name', 'Admin');})->orDoesntHave('roles')->get();
In Eloquent, you can combine whereHas()
and orDoesntHave()
in one sentence.
User::whereHas('roles', function($query) { $query->where('name', 'Admin');})->orDoesntHave('roles')->get();