Answer the question
In order to leave comments, you need to log in
Wherehas the right way to write a query?
There are permissions for one of them, the name is 'test',
I want to get all the roles for which permission != test, but for some reason all are returned
$roles = UserRole::whereHas('permissions', function (Builder $query) {
$query->where('name', '!=', 'test');
});
$roles = UserRole::whereHas('permissions', function (Builder $query) {
$query->where('name', '=', 'test');
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question