How do I get only users
from database where they have no role assigned?
User belongs to many roles, the exact relation is:
public function roles() {
return $this->belongsToMany(Role::class, 'user_has_roles', 'user_id', 'role_id');
}
My problem is, that I do only work with Query builder
, not with the model so I do not want to use relation.
EDIT:
I am working with migrations, so please no solutions when using model.