/** * Creates a new Peso model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Peso(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->fecha]); } else { return $this->render('create', ['model' => $model]); } }
/** * Creates a new Peso model. * If creation is successful, the browser will be redirected to the 'view page. * @return mixed */ public function actionCreate() { $model = new Peso(); $model->fecha = date("Y-m-d"); //'1960-01-12'; if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['index']); // return $this->redirect(['view', 'id' => $model->fecha]); } else { return $this->render('create', ['model' => $model]); } }