Пример #1
0
 /**
  * Creates a new Country model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Country();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->countryid]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Пример #2
0
 public function run()
 {
     $model = new Country();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->save()) {
             Yii::$app->session->setFlash('success', Yii::t('app', 'Country successfully saved.'));
             $model = new Country();
         } else {
             Yii::$app->session->setFlash('error', Yii::t('app', 'Error on saving country.'));
         }
     }
     return $this->controller->render('manage', ['model' => $model]);
 }