/**
  * Creates a new Province model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Province();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->province_id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 public function actionMajor()
 {
     $request = Yii::$app->request;
     if ($request->isPost) {
         $id = $request->post('id');
         $name = $request->post('name');
         if ($id) {
             $major = MajorJob::findOne($id);
             CommonFunctions::createAlertMessage("修改成功", "success");
         } else {
             $major = new Province();
             CommonFunctions::createAlertMessage("添加成功", "success");
         }
         $major->name = $name;
         if (!$major->save()) {
             throw new Exception("Basic Date area save error");
         }
         return $this->redirect(['basic-data/major']);
     }
     $models = MajorJob::findAllForObject();
     return $this->render('major', ['models' => $models]);
 }