|
- <?php
-
-
-
- namespace domain\Order\Order;
-
- use yii\data\ActiveDataProvider;
-
- class OrderSearch extends Order
- {
- public function search($params)
- {
- $paramsSearch = [];
- if(isset($params['id_user'])) {
- $paramsSearch['id_user'] = $params['id_user'];
- }
-
- $query = Order::searchQuery($paramsSearch, [
- 'ignore_id_producer' => true,
- 'orderby' => isset($params['order_by']) ? $params['order_by'] : 'distribution.date DESC'
- ]);
-
- $dataProvider = new ActiveDataProvider([
- 'query' => $query,
- 'sort' => ['attributes' => []],
- 'pagination' => [
- 'pageSize' => 20,
- ],
- ]);
-
- $this->load($params);
- if (!$this->validate()) {
- return $dataProvider;
- }
-
- return $dataProvider;
- }
- }
|