public function run($id)
    {
        if (!Yii::$app->request->isPost) {
            throw new MethodNotAllowedHttpException('Method Not Allowed. This url can only handle post');
        }
        $position = Yii::$app->request->getQueryParam($this->positionParam, null);
        if (empty($position)) {
            throw new BadRequestHttpException(Yii::t('yii', '{attribute} cannot be blank.', ['attribute' => $this->positionParam]));
        }

        $model = $this->findModel($id);

        $this->positionModel($model, $position);

        return $this->respondSuccess($model);
    }
public function run($id)
    {
        if (!Yii::$app->request->isPost) {
            throw new MethodNotAllowedHttpException('Method Not Allowed. This url can only handle post');
        }
        $position = Yii::$app->request->getQueryParam($this->positionParam, null);
        if (empty($position)) {
            throw new BadRequestHttpException(Yii::t('yii', '{attribute} cannot be blank.', ['attribute' => $this->positionParam]));
        }

        $model = $this->findModel($id);

        $this->positionModel($model, $position);

        return $this->respondSuccess($model);
    }
public function run ( $ id ) { if ( ! Yii :: $ app -> request -> isPost ) { throw new MethodNotAllowedHttpException ( 'Method Not Allowed. This url can only handle post' ) ; } $ position = Yii :: $ app -> request -> getQueryParam ( $ this -> positionParam , null ) ; if ( empty ( $ position ) ) { throw new BadRequestHttpException ( Yii :: t ( 'yii' , '{attribute} cannot be blank.' , [ 'attribute' => $ this -> positionParam ] ) ) ; } $ model = $ this -> findModel ( $ id ) ; $ this -> positionModel ( $ model , $ position ) ; return $ this -> respondSuccess ( $ model ) ; }
Updates existing record specified by id.
@param mixed $id id of the model to be deleted.
@return mixed response.
@throws BadRequestHttpException on invalid request.
@throws MethodNotAllowedHttpException on invalid request.
Updates existing record specified by id .