Where Clauses for existing

Posted 4 months ago by xtremer360

I have trying to come up with an eloquent query where it checks to make sure that a model is not associated to an additional group entity that is active other than the one past in.

ModelA is apart of Group1 and that group is active.

I want to do a check to make sure ModelA is not apart of another GroupB which is active as well.

The following isn't right because I can't use where on boolean. Anyone know what I should do for this query.

$modelA->groups->contains($this->group)->where()->isActive().

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