/** * Creates a new Professions model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Professions(); 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 Professions model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Professions(); $data = Yii::$app->request->post(); $model->profession = isset($data['profession']) ? $data['profession'] : ''; if ($model->save()) { return array('flag' => 1, 'msg' => 'create success!'); } else { return array('flag' => 0, 'msg' => 'create fail!'); } }