diff --git a/common/models/CategorySearch.php b/common/models/CategorySearch.php index 4b2e392..c22a1d6 100644 --- a/common/models/CategorySearch.php +++ b/common/models/CategorySearch.php @@ -9,13 +9,12 @@ use common\models\Category; /** * CategorySearch represents the model behind the search form of `\common\models\Category`. */ -class CategorySearch extends Category -{ +class CategorySearch extends Category { + /** * {@inheritdoc} */ - public function rules() - { + public function rules() { return [ [['id', 'icon_type', 'sort_order', 'created_at', 'updated_at'], 'integer'], [['cat_name', 'icon', 'description'], 'safe'], @@ -25,8 +24,7 @@ class CategorySearch extends Category /** * {@inheritdoc} */ - public function scenarios() - { + public function scenarios() { // bypass scenarios() implementation in the parent class return Model::scenarios(); } @@ -38,14 +36,21 @@ class CategorySearch extends Category * * @return ActiveDataProvider */ - public function search($params) - { + public function search($params) { $query = Category::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider([ 'query' => $query, + 'pagination' => [ + 'pageSizeLimit' => [1, 200] + ], + 'sort' => [ + 'defaultOrder' => [ + 'id' => SORT_DESC, + ] + ], ]); $this->load($params); @@ -66,9 +71,10 @@ class CategorySearch extends Category ]); $query->andFilterWhere(['like', 'cat_name', $this->cat_name]) - ->andFilterWhere(['like', 'icon', $this->icon]) - ->andFilterWhere(['like', 'description', $this->description]); + ->andFilterWhere(['like', 'icon', $this->icon]) + ->andFilterWhere(['like', 'description', $this->description]); return $dataProvider; } + } diff --git a/kcadmin/assets/AppAsset.php b/kcadmin/assets/AppAsset.php index 7c22300..43351e5 100644 --- a/kcadmin/assets/AppAsset.php +++ b/kcadmin/assets/AppAsset.php @@ -21,6 +21,5 @@ class AppAsset extends AssetBundle 'yii\bootstrap\BootstrapAsset', 'yii\bootstrap\BootstrapPluginAsset', 'blobt\web\AdminlteAsset', - 'blobt\web\DatatableBootstrap' ]; } diff --git a/kcadmin/views/category/create.php b/kcadmin/views/category/create.php index a727e42..48abbb7 100644 --- a/kcadmin/views/category/create.php +++ b/kcadmin/views/category/create.php @@ -14,7 +14,7 @@ $this->params['breadcrumbs'][] = $this->title;