/** * @return string|\yii\web\Response */ public function run() { $model = new Empresas(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->controller->redirect(['detalle', 'id' => $model->id]); } else { return $this->controller->render('crear', ['model' => $model]); } }