Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Type::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'show_category' => $this->show_category]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'alias', $this->alias]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
 /**
  * Check that blog just installed
  * @return bool
  */
 public static function isJustInstalled()
 {
     $types = Type::find()->all();
     $categories = Category::find()->all();
     return empty($types) || empty($categories) ?: false;
 }