/** * Creates a new Permission model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Permission(); if ($model->load(Yii::$app->request->post())) { try { if ($model->save()) { Yii::$app->session->setFlash('success', Yii::t('app', 'Permission created')); return $this->redirect(['index']); } else { Yii::$app->session->setFlash('error', Yii::t('app', 'Permission create failed')); } } catch (Exception $e) { Yii::$app->session->setFlash('error', Yii::t('app', 'Permission create failed')); } } return $this->render('create', ['model' => $model]); }