示例#1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = SeoItems::find();
     $dataProvider = new ActiveDataProvider(['query' => $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;
     }
     $query->andFilterWhere(['id' => $this->id, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'link', $this->link])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'keywords', $this->keywords])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'canonical', $this->canonical]);
     return $dataProvider;
 }
示例#2
0
 public function init()
 {
     $this->_seo_data = SeoItems::find()->where(['link' => $_SERVER['REQUEST_URI'], 'status' => SeoItems::STATUS_PUBLISHED])->one();
     $this->setSeoData($this->_seo_data);
 }