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