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