public static function moveToBefore($moveNavId, $toBeforeNavId)
    {
        $move = self::findOne($moveNavId);
        $to = self::findOne($toBeforeNavId);

        if (!$move || !$to) {
            return false;
        }
        
        $response = self::checkDuplicateAlias($move->id, $to->parent_nav_id);
        
        if ($response !== true) {
            return $response;
        }

        $to->moveUpstairs();

        $move->nav_container_id = $to->nav_container_id;
        $move->parent_nav_id = $to->parent_nav_id;
        $move->sort_index = $to->sort_index;
        $move->update();

        foreach ($move->getRecursiveChildren() as $child) {
            $child->updateAttributes(['nav_container_id' => $to->nav_container_id]);
        }
        
        return true;
    }
public static function moveToBefore($moveNavId, $toBeforeNavId)
    {
        $move = self::findOne($moveNavId);
        $to = self::findOne($toBeforeNavId);

        if (!$move || !$to) {
            return false;
        }
        
        $response = self::checkDuplicateAlias($move->id, $to->parent_nav_id);
        
        if ($response !== true) {
            return $response;
        }

        $to->moveUpstairs();

        $move->nav_container_id = $to->nav_container_id;
        $move->parent_nav_id = $to->parent_nav_id;
        $move->sort_index = $to->sort_index;
        $move->update();

        foreach ($move->getRecursiveChildren() as $child) {
            $child->updateAttributes(['nav_container_id' => $to->nav_container_id]);
        }
        
        return true;
    }
public static function moveToBefore ( $ moveNavId , $ toBeforeNavId ) { $ move = self :: findOne ( $ moveNavId ) ; $ to = self :: findOne ( $ toBeforeNavId ) ; if ( ! $ move || ! $ to ) { return false ; } $ response = self :: checkDuplicateAlias ( $ move -> id , $ to -> parent_nav_id ) ; if ( $ response !== true ) { return $ response ; } $ to -> moveUpstairs ( ) ; $ move -> nav_container_id = $ to -> nav_container_id ; $ move -> parent_nav_id = $ to -> parent_nav_id ; $ move -> sort_index = $ to -> sort_index ; $ move -> update ( ) ; foreach ( $ move -> getRecursiveChildren ( ) as $ child ) { $ child -> updateAttributes ( [ 'nav_container_id' => $ to -> nav_container_id ] ) ; } return true ; }
Move a nav model before another nav model.

@param integer $moveNavId
@param integer $toBeforeNavId
@return boolean|boolean|mixed
Move a nav model before another nav model .