public function actionIndex($catid, $pid = 0) { $query = Dict::find()->where(['parent_id' => $pid, 'category_id' => $catid]); $locals = LuLu::getPagedRows($query, ['order' => 'sort_num asc']); $locals['pid'] = $pid; $locals['parent'] = $this->findModel($pid); $locals['parents'] = Dict::getParents($pid); $locals['category'] = DictCategory::findOne($catid); return $this->render('index', $locals); }
public function search($params) { $query = Dict::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'parent_id' => $this->parent_id, 'sort_num' => $this->sort_num]); $query->andFilterWhere(['like', 'category_key', $this->category_key])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'value', $this->value])->andFilterWhere(['like', 'datatype', $this->datatype]); return $dataProvider; }