예제 #1
0
 /**
  * Creates a new PrintTemplate model.
  * If creation is successful, the browser will be redirected to the 'update' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new PrintTemplate();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         Yii::$app->session->setFlash('success', __('Your changes have been saved successfully.'));
         return $this->redirect(['update', 'id' => $model->id]);
     } else {
         $model->validate(['margin_top', 'margin_bottom', 'margin_left', 'margin_right', 'wrapper']);
         return $this->render('create', ['model' => $model]);
     }
 }