src/Models/Tree.php
public function move($target_id, $move_type)
	{
		$targetNode = $this->getNode($target_id);
		if (empty($target_id) || empty($targetNode)) return NULL;

		if ($move_type == 'inner') //成为别人子集，则直接调用,放入子集
			return $this->update([$this->parentKey => $target_id]); //自动调取changeParent

		if ($targetNode->getParentKey() != $this->getParentKey()) //父级不相同
			$this->update([$this->parentKey => $targetNode->getParentKey()]); //自动调取changeParent
		if (!empty($this->orderKey))
		{
			$order = intval($targetNode->getOrderKey()) + ($move_type == 'prev' ? 0 : 1);
			//更新同父级下所有的顺序
			static::where($this->parentKey, $targetNode->getParentKey())->where($this->orderKey, '>=', $order)->increment($this->orderKey);
			$this->update([$this->orderKey => $order]); //更新自己的顺序
		}

		return $this;
	}
public function move($target_id, $move_type)
	{
		$targetNode = $this->getNode($target_id);
		if (empty($target_id) || empty($targetNode)) return NULL;

		if ($move_type == 'inner') //成为别人子集，则直接调用,放入子集
			return $this->update([$this->parentKey => $target_id]); //自动调取changeParent

		if ($targetNode->getParentKey() != $this->getParentKey()) //父级不相同
			$this->update([$this->parentKey => $targetNode->getParentKey()]); //自动调取changeParent
		if (!empty($this->orderKey))
		{
			$order = intval($targetNode->getOrderKey()) + ($move_type == 'prev' ? 0 : 1);
			//更新同父级下所有的顺序
			static::where($this->parentKey, $targetNode->getParentKey())->where($this->orderKey, '>=', $order)->increment($this->orderKey);
			$this->update([$this->orderKey => $order]); //更新自己的顺序
		}

		return $this;
	}
移动节点
@param  integer $target_id   目标CID
@param  string $move_type     [inner, prev, next]分别表示：子集、前一位、后一位
@return boolean