diff --git a/controllers/SeoController.php b/controllers/SeoController.php index f5e8486..1aca45c 100755 --- a/controllers/SeoController.php +++ b/controllers/SeoController.php @@ -1,134 +1,134 @@ -[ - 'class' => AccessBehavior::className(), - 'rules' => - ['site' => - [ - [ - 'actions' => ['login', 'error'], - 'allow' => true, - ] - ] - ] - ], - 'verbs' => [ - 'class' => VerbFilter::className(), - - ], - ]; - } - - /** - * Lists all Seo models. - * @return mixed - */ - public function actionIndex() - { - $searchModel = new SeoSearch(); - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - - return $this->render('index', [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - ]); - } - - /** - * Displays a single Seo model. - * @param integer $id - * @return mixed - */ - public function actionView($id) - { - return $this->render('view', [ - 'model' => $this->findModel($id), - ]); - } - - /** - * Creates a new Seo model. - * If creation is successful, the browser will be redirected to the 'view' page. - * @return mixed - */ - public function actionCreate() - { - $model = new Seo(); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->id]); - } else { - return $this->render('create', [ - 'model' => $model, - ]); - } - } - - /** - * Updates an existing Seo model. - * If update is successful, the browser will be redirected to the 'view' page. - * @param integer $id - * @return mixed - */ - public function actionUpdate($id) - { - $model = $this->findModel($id); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->id]); - } else { - return $this->render('update', [ - 'model' => $model, - ]); - } - } - - /** - * Deletes an existing Seo model. - * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $id - * @return mixed - */ - public function actionDelete($id) - { - $this->findModel($id)->delete(); - - return $this->redirect(['index']); - } - - /** - * Finds the Seo model based on its primary key value. - * If the model is not found, a 404 HTTP exception will be thrown. - * @param integer $id - * @return Seo the loaded model - * @throws NotFoundHttpException if the model cannot be found - */ - protected function findModel($id) - { - if (($model = Seo::findOne($id)) !== null) { - return $model; - } else { - throw new NotFoundHttpException('The requested page does not exist.'); - } - } -} +[ + 'class' => AccessBehavior::className(), + 'rules' => + ['site' => + [ + [ + 'actions' => ['login', 'error'], + 'allow' => true, + ] + ] + ] + ], + 'verbs' => [ + 'class' => VerbFilter::className(), + + ], + ]; + } + + /** + * Lists all Seo models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new SeoSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single Seo model. + * @param integer $id + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new Seo model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new Seo(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } else { + return $this->render('create', [ + 'model' => $model, + ]); + } + } + + /** + * Updates an existing Seo model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param integer $id + * @return mixed + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } else { + return $this->render('update', [ + 'model' => $model, + ]); + } + } + + /** + * Deletes an existing Seo model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * @param integer $id + * @return mixed + */ + public function actionDelete($id) + { + $this->findModel($id)->delete(); + + return $this->redirect(['index']); + } + + /** + * Finds the Seo model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return Seo the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = Seo::findOne($id)) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } +} diff --git a/models/SeoSearch.php b/models/SeoSearch.php index 2e6a63c..770807d 100755 --- a/models/SeoSearch.php +++ b/models/SeoSearch.php @@ -1,74 +1,74 @@ - $query, - ]); - - $this->load($params); - - if (!$this->validate()) { - // uncomment the following line if you do not want to return any records when validation fails - // $query->where('0=1'); - return $dataProvider; - } - - // grid filtering conditions - $query->andFilterWhere([ - 'id' => $this->id, - ]); - - $query->andFilterWhere(['like', 'url', $this->url]) - ->andFilterWhere(['like', 'title', $this->title]) - ->andFilterWhere(['like', 'meta', $this->meta]) - ->andFilterWhere(['like', 'description', $this->description]) - ->andFilterWhere(['like', 'h1', $this->h1]) - ->andFilterWhere(['like', 'seo_text', $this->seo_text]); - - return $dataProvider; - } -} + $query, + ]); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'id' => $this->id, + ]); + + $query->andFilterWhere(['like', 'url', $this->url]) + ->andFilterWhere(['like', 'title', $this->title]) + ->andFilterWhere(['like', 'meta', $this->meta]) + ->andFilterWhere(['like', 'description', $this->description]) + ->andFilterWhere(['like', 'h1', $this->h1]) + ->andFilterWhere(['like', 'seo_text', $this->seo_text]); + + return $dataProvider; + } +} diff --git a/views/seo/_form.php b/views/seo/_form.php index 9853be6..5236aa3 100755 --- a/views/seo/_form.php +++ b/views/seo/_form.php @@ -1,41 +1,41 @@ - - -
- = Html::a(Yii::t('app', 'Create Seo'), ['create'], ['class' => 'btn btn-success']) ?> -
- = GridView::widget([ - 'dataProvider' => $dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - ['class' => 'yii\grid\SerialColumn'], - - 'id', - 'url:url', - 'meta', - 'h1', - // 'seo_text:ntext', - - ['class' => 'yii\grid\ActionColumn'], - ], - ]); ?> -+ = Html::a(Yii::t('app', 'Create Seo'), ['create'], ['class' => 'btn btn-success']) ?> +
+ = GridView::widget([ + 'dataProvider' => $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + + 'id', + 'url:url', + 'meta', + 'h1', + // 'seo_text:ntext', + + ['class' => 'yii\grid\ActionColumn'], + ], + ]); ?> +- = Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> - = Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], [ - 'class' => 'btn btn-danger', - 'data' => [ - 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), - 'method' => 'post', - ], - ]) ?> -
- - = DetailView::widget([ - 'model' => $model, - 'attributes' => [ - 'id', - 'url:url', - 'title', - 'meta', - 'description', - 'h1', - 'seo_text:ntext', - ], - ]) ?> - -+ = Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> + = Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), + 'method' => 'post', + ], + ]) ?> +
+ + = DetailView::widget([ + 'model' => $model, + 'attributes' => [ + 'id', + 'url:url', + 'title', + 'meta', + 'description', + 'h1', + 'seo_text:ntext', + ], + ]) ?> + +