/** * Lists all LetCategory models. * @return mixed */ public function actionIndex() { $module = Yii::$app->request->get('module'); if (empty($module)) { throw new NotFoundHttpException('The requested page does not exist.'); } $categories = LetCategory::find()->where(['module' => $module])->addOrderBy('lft')->all(); return $this->render('index', ['categories' => $categories, 'module' => $module]); }
public function search($params) { $query = LetCategory::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'root' => $this->root, 'lft' => $this->lft, 'rgt' => $this->rgt, 'level' => $this->level]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'module', $this->module]); return $dataProvider; }