/** * Creates a new Ticket model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Ticket(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('createTicket', ['model' => $model]); } }
/** * Creates a new Ticket model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Ticket(); $model->type = Ticket::TYPE_CSR; if ($model->load(Yii::$app->request->post()) && $model->validate()) { $model->validateDate(); if ($model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return \yii\helpers\VarDumper::dumpAsString($model->errors); } } else { $model->parseDate(); return $this->render('createCsr', ['model' => $model]); } }