/** * Creates a new Unit model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Unit(); if ($model->load(Yii::$app->request->post()) && $model->save()) { Yii::$app->getSession()->setFlash('unit_create_success', ['type' => Growl::TYPE_SUCCESS, 'title' => '<b>' . Yii::t('backend', 'Success') . '</b>', 'icon' => 'glyphicon glyphicon-ok-sign', 'body' => '<strong>' . $model->unit_text . '</strong> ' . Yii::t('backend', 'has been added.')]); return $this->redirect(['index']); } else { return $this->render('create', ['model' => $model]); } }