backend/modules/settings/controllers/CompaniesController.php
/**
     * Creates a new Companies model.
     * If creation is successful, the browser will be redirected to the 'view' page.
     * @return mixed
     */
Creates a new Companies model.
If creation is successful, the browser will be redirected to the 'view' page.
@return mixed
Creates a new Companies model . If creation is successful the browser will be redirected to the ' view ' page . @return mixed
public function actionCreate()
    {
        $model = new Companies();
        if(Yii::$app->request->isAjax && $model->load($_POST)){
            Yii::$app->response->format ='json';
            return \yii\widgets\ActiveForm::validate($model);  
        }
        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            return $this->redirect(['view', 'id' => $model->company_id]);
        } else {
            return $this->render('create', [
                'model' => $model,
            ]);
        }
    }
public function actionCreate ( ) { $ model = new Companies ( ) ; if ( Yii :: $ app -> request -> isAjax && $ model -> load ( $ _POST ) ) { Yii :: $ app -> response -> format = 'json' ; return \ yii \ widgets \ ActiveForm :: validate ( $ model ) ; } if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { return $ this -> redirect ( [ 'view' , 'id' => $ model -> company_id ] ) ; } else { return $ this -> render ( 'create' , [ 'model' => $ model , ] ) ; } }
Creates a new Companies model.
Creates a new Companies model .