예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Meta::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'keywords', $this->keywords])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'route', $this->route]);
     return $dataProvider;
 }
예제 #2
0
파일: Meta.php 프로젝트: babagay/razzd
 public function findMeta($event)
 {
     if (Yii::$app->controller->action->id == 'index') {
         return;
     }
     $route = $this->route;
     $model = \backend\models\Meta::findByRoute($route);
     if (isset($model->id)) {
         $this->owner->meta_title = $model->title;
         $this->owner->meta_keywords = $model->keywords;
         $this->owner->meta_description = $model->description;
     }
 }
예제 #3
0
 /**
  * Finds the Meta model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Meta the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Meta::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }