backend/controllers/SoftwareController.php
/**
     * Creates a new Software model.
     * If creation is successful, the browser will be redirected to the 'view' page.
     * @return mixed
     */
Creates a new Software model.
If creation is successful, the browser will be redirected to the 'view' page.
@return mixed
Creates a new Software model . If creation is successful the browser will be redirected to the ' view ' page . @return mixed
public function actionCreate()
    {
        $model = new Software();
        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->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('create', [
            'model' => $model,
        ]);
    }
public function actionCreate ( ) { $ model = new Software ( ) ; 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 -> 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 ( 'create' , [ 'model' => $ model , ] ) ; }
Creates a new Software model.
Creates a new Software model .
//return $this->redirect(['view', 'id' => $model->software_id]);