Adldap\Models\Traits\HasMemberOfTrait::removeGroup PHP Method

removeGroup() public method

Removes the current model from the specified group.
public removeGroup ( string | Group $group ) : boolean
$group string | Adldap\Models\Group
return boolean
    public function removeGroup($group)
    {
        if (is_string($group)) {
            // If the group is a string, we'll assume the dev is passing
            // in a DN string of the group. We'll try to locate it.
            $group = $this->getQuery()->newInstance()->findByDn($group);
        }
        if ($group instanceof Group) {
            // If the group is Group model instance, we can
            // remove the current models DN from the group.
            return $group->removeMember($this->getDn());
        }
        return false;
    }