public function move($newParentDn, $deleteOldRdn = true)
    {
        // First we'll explode the current models distinguished name and keep their attributes prefixes.
        $parts = Utilities::explodeDn($this->getDn(), $removeAttrPrefixes = false);

        // If the current model has an empty RDN, we can't move it.
        if ((int) Arr::first($parts) === 0) {
            throw new UnexpectedValueException("Current model does not contain an RDN to move.");
        }

        // Looks like we have a DN. We'll retrieve the leftmost RDN (the identifier).
        $rdn = Arr::get($parts, 0);

        return $this->rename($rdn, $newParentDn, $deleteOldRdn);
    }
public function move($newParentDn, $deleteOldRdn = true)
    {
        // First we'll explode the current models distinguished name and keep their attributes prefixes.
        $parts = Utilities::explodeDn($this->getDn(), $removeAttrPrefixes = false);

        // If the current model has an empty RDN, we can't move it.
        if ((int) Arr::first($parts) === 0) {
            throw new UnexpectedValueException("Current model does not contain an RDN to move.");
        }

        // Looks like we have a DN. We'll retrieve the leftmost RDN (the identifier).
        $rdn = Arr::get($parts, 0);

        return $this->rename($rdn, $newParentDn, $deleteOldRdn);
    }
public function move ( $ newParentDn , $ deleteOldRdn = true ) { // First we'll explode the current models distinguished name and keep their attributes prefixes. $ parts = Utilities :: explodeDn ( $ this -> getDn ( ) , $ removeAttrPrefixes = false ) ; // If the current model has an empty RDN, we can't move it. if ( ( int ) Arr :: first ( $ parts ) === 0 ) { throw new UnexpectedValueException ( "Current model does not contain an RDN to move." ) ; } // Looks like we have a DN. We'll retrieve the leftmost RDN (the identifier). $ rdn = Arr :: get ( $ parts , 0 ) ; return $ this -> rename ( $ rdn , $ newParentDn , $ deleteOldRdn ) ; }
Moves the current model into the given new parent.

For example: $user->move($ou);

@param Model|string $newParentDn  The new parent of the current model.
@param bool         $deleteOldRdn Whether to delete the old models relative distinguished name once renamed / moved.

@return bool
Moves the current model into the given new parent .