/**
  * Creates a new History model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new History();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Esempio n. 2
0
 /**
  * Creates a new History model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new History();
     if (\Yii::$app->request->method == 'POST') {
         $numberBig = 0;
         $numberBig = (int) str_replace(' ', '', \Yii::$app->request->post('History')['number']);
         $model->number = $numberBig;
         $model->use_date = \Yii::$app->request->post('History')['use_date'];
         if ($model->save()) {
             $this->redirect('/card/view?number=' . $model->number);
         }
     } else {
         $number = \Yii::$app->request->get('number');
         return $this->render('create', ['model' => $model, 'number' => $number]);
     }
 }