public function actionVacancy() { if (Yii::$app->user->isGuest) { $this->redirect(Yii::$app->user->loginUrl); } $model = BVacancy::find()->where(['site' => 1])->one(); if (!$model) { $model = new BVacancy(); $model->site = 1; } if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->render('vacancy', ['model' => $model, 'success' => true]); } return $this->render('vacancy', ['model' => $model]); }
public function actionVacancy() { $model = BVacancy::find()->where(['site' => 1])->one(); $title = $model->title; $text = $model->text; $keywords = $model->keywords; $description = $model->description; return $this->render('vacancy', ['title' => $title, 'text' => $text, 'keywords' => $keywords, 'description' => $description]); }