예제 #1
0
 /**
  * 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]);
 }
예제 #2
0
 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;
 }