/** * Creates a new WidgetText model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new WidgetText(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['index']); } else { return $this->render('create', ['model' => $model]); } }
private function saveRobotsRow($key, $title) { $model = new WidgetText(); $model->key = $key; $model->title = $title; $model->domain_id = \Yii::$app->user->identity->domain_id; $model->body = 'User-agent: * ' . PHP_EOL . 'Disallow:/'; $model->status = 1; $model->save(); }