public function actionUp($id)
    {
        if ($category = Category::findOne($id)) {
            $this->trigger(self::EVENT_BEFORE_EDIT_CATEGORY);

            if ($category->movePrev()) {
                $this->trigger(self::EVENT_AFTER_EDIT_CATEGORY,
                    new CategoryEvent(['id' => $id]));
                if (\Yii::$app->request->isAjax) {
                    return 'up';
                }
            }
            return $this->actionIndex();
        }
        throw new NotFoundHttpException();
    }
public function actionUp($id)
    {
        if ($category = Category::findOne($id)) {
            $this->trigger(self::EVENT_BEFORE_EDIT_CATEGORY);

            if ($category->movePrev()) {
                $this->trigger(self::EVENT_AFTER_EDIT_CATEGORY,
                    new CategoryEvent(['id' => $id]));
                if (\Yii::$app->request->isAjax) {
                    return 'up';
                }
            }
            return $this->actionIndex();
        }
        throw new NotFoundHttpException();
    }
public function actionUp ( $ id ) { if ( $ category = Category :: findOne ( $ id ) ) { $ this -> trigger ( self :: EVENT_BEFORE_EDIT_CATEGORY ) ; if ( $ category -> movePrev ( ) ) { $ this -> trigger ( self :: EVENT_AFTER_EDIT_CATEGORY , new CategoryEvent ( [ 'id' => $ id ] ) ) ; if ( \ Yii :: $ app -> request -> isAjax ) { return 'up' ; } } return $ this -> actionIndex ( ) ; } throw new NotFoundHttpException ( ) ; }
Changes category position to up

@param integer $id
@throws NotFoundHttpException
@return mixed
Changes category position to up