|
@ -12,7 +12,10 @@ use yii\helpers\ArrayHelper; |
|
|
*/ |
|
|
*/ |
|
|
class CategorySearch extends Category |
|
|
class CategorySearch extends Category |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @return array |
|
|
|
|
|
* 增加创建时间查询字段 |
|
|
|
|
|
*/ |
|
|
public function attributes() |
|
|
public function attributes() |
|
|
{ |
|
|
{ |
|
|
return ArrayHelper::merge(['created_at_range'], parent::attributes()); |
|
|
return ArrayHelper::merge(['created_at_range'], parent::attributes()); |
|
@ -38,9 +41,13 @@ class CategorySearch extends Category |
|
|
return Model::scenarios(); |
|
|
return Model::scenarios(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @param $params |
|
|
|
|
|
* @return ActiveDataProvider |
|
|
|
|
|
* 不分页的所有数据 |
|
|
|
|
|
*/ |
|
|
public function allData($params) |
|
|
public function allData($params) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
$query = Category::find(); |
|
|
$query = Category::find(); |
|
|
$dataProvider = new ActiveDataProvider([ |
|
|
$dataProvider = new ActiveDataProvider([ |
|
|
'query' => $query, |
|
|
'query' => $query, |
|
@ -79,6 +86,12 @@ class CategorySearch extends Category |
|
|
return $this->filter($query, $dataProvider); |
|
|
return $this->filter($query, $dataProvider); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @param $query |
|
|
|
|
|
* @param $dataProvider |
|
|
|
|
|
* @return ActiveDataProvider |
|
|
|
|
|
* 条件筛选 |
|
|
|
|
|
*/ |
|
|
private function filter($query, $dataProvider) |
|
|
private function filter($query, $dataProvider) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|