backend/controllers/SoftwareController.php
/**
     * Updates an existing Software model.
     * If update is successful, the browser will be redirected to the 'view' page.
     * @param string $id
     * @return mixed
     */
Updates an existing Software model.
If update is successful, the browser will be redirected to the 'view' page.
@param string $id
@return mixed
Updates an existing Software model . If update is successful the browser will be redirected to the ' view ' page . @param string $id @return mixed
public function actionUpdate($id)
    {
        $model = $this->findModel($id);
        if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
            Yii::$app->response->format = Response::FORMAT_JSON;
            return ActiveForm::validate($model);
        }
        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            $model->software_file = UploadedFile::getInstance($model, 'software_file');
            if ($model->validate()) {
                    if ($model->save()) {
                        return $this->redirect(['index']);
                    } else {
                        Yii::$app->session->setFlash('danger', 'Failed save model.');
                    }
            }
        }
        return $this->render('update', [
                'model' => $model,
        ]);
    }
public function actionUpdate ( $ id ) { $ model = $ this -> findModel ( $ id ) ; if ( Yii :: $ app -> request -> isAjax && $ model -> load ( Yii :: $ app -> request -> post ( ) ) ) { Yii :: $ app -> response -> format = Response :: FORMAT_JSON ; return ActiveForm :: validate ( $ model ) ; } if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { $ model -> software_file = UploadedFile :: getInstance ( $ model , 'software_file' ) ; if ( $ model -> validate ( ) ) { if ( $ model -> save ( ) ) { return $ this -> redirect ( [ 'index' ] ) ; } else { Yii :: $ app -> session -> setFlash ( 'danger' , 'Failed save model.' ) ; } } } return $ this -> render ( 'update' , [ 'model' => $ model , ] ) ; }
Updates an existing Software model.
Updates an existing Software model .
//var_dump($model->software_status); exit; //return $this->redirect(['view', 'id' => $model->software_id]);