/** * Creates a new AdPosition model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { if (!$this->is_access('adposition/create')) { Yii::$app->session->setFlash('error', $this->errorInfo); return $this->redirect($this->redirectUrl); } $model = new AdPosition(); if ($model->load(Yii::$app->request->post()) && $model->save()) { Yii::$app->session->setFlash('success', '添加成功'); return $this->redirect(['index']); } else { Yii::$app->view->params['meta_title'] = '添加广告位'; return $this->render('create', ['model' => $model]); } }