controllers/AuthItemController.php
public function actionTreeMove($id, $pid)
    {
        $child = $this->findModel($id);
        $oldParent = $this->findModel($pid);
        $newParent = $this->findModel(Yii::$app->request->post('pid'));
        $child->move($oldParent, $newParent);
        echo json_encode($child->nodeAttributes($child, $newParent->id, time()));
    }
public function actionTreeMove($id, $pid)
    {
        $child = $this->findModel($id);
        $oldParent = $this->findModel($pid);
        $newParent = $this->findModel(Yii::$app->request->post('pid'));
        $child->move($oldParent, $newParent);
        echo json_encode($child->nodeAttributes($child, $newParent->id, time()));
    }
public function actionTreeMove ( $ id , $ pid ) { $ child = $ this -> findModel ( $ id ) ; $ oldParent = $ this -> findModel ( $ pid ) ; $ newParent = $ this -> findModel ( Yii :: $ app -> request -> post ( 'pid' ) ) ; $ child -> move ( $ oldParent , $ newParent ) ; echo json_encode ( $ child -> nodeAttributes ( $ child , $ newParent -> id , time ( ) ) ) ; }
Detaches model from old parent.
And attaches to the new one.
@param integer $id mode id
@param integer $pid parent id
@return \yii\web\View action view
Detaches model from old parent . And attaches to the new one .