/** * Creates a new Ruta model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Ruta(); if ($model->load(Yii::$app->request->post())) { $validar = $model->validar(); if ($validar == 'OK' && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { Yii::$app->getSession()->setFlash('danger', $validar); return $this->render('create', ['model' => $model]); } } else { return $this->render('create', ['model' => $model]); } }