/**
  * Creates data provider instance with search query applied
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     // if the ID is set, use it to get all the children article categories
     $query = ArticleCategory::find()->andWhere(['parent_id' => isset($params['id']) && is_numeric($params['id']) ? $params['id'] : null])->andWhere(['status' => 1]);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'parent_id' => $this->parent_id, 'slug' => $this->slug]);
     $query->andFilterWhere(['like', 'title', $this->title]);
     return $dataProvider;
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getParent()
 {
     return $this->hasMany(ArticleCategory::className(), ['id' => 'parent_id']);
 }