/** * Creates a new Faer model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate($categoria = 0, $subcategoria = 0, $convocatoria = 0) { $model = new Faer(); if (!isset($categoria) && $categoria == 0) { $categoria = 1; } $model->categoria = $categoria; if (!isset($subcategoria) && $subcategoria == 0) { $subcategoria = 1; } $model->subcategoria = $subcategoria; 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()) { return $this->redirect(['/detalle-proyecto/create', 'numero' => $model->numero]); } else { return $this->render('create', ['model' => $model]); } }