Creates data provider instance with search query applied.
@param $params
@param array $dataProviderConfig
@throws \yii\base\InvalidConfigException
@return ActiveDataProvider
516304
public function search($params, $dataProviderConfig = [])
    {
        /**
         * @var ActiveRecord
         * @var ActiveRecord $class
         * @var ActiveQuery $query
         */
        $class = get_parent_class();
        $query = $class::find(); // $class::find()->orderBy($sort->orders)->all(); if $sort is Sort

        $dataProvider = new ActiveDataProvider(ArrayHelper::merge(['query' => $query], $dataProviderConfig));

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        foreach ($this->attributes() as $attribute) {
            if (($value = $this->{$attribute}) === null) {
                continue;
            }
            /*
             * Extracts underscore suffix from the key.
             *
             * Examples:
             * client_id -> 0 - client_id, 1 - client, 2 - _id, 3 - id
             * server_owner_like -> 0 - server_owner_like, 1 - server_owner, 2 - _like, 3 - like
             */
            preg_match('/^(.*?)(_((?:.(?!_))+))?$/', $attribute, $matches);

            /// If the suffix is in the list of acceptable suffix filer conditions
            if ($matches[3] && in_array($matches[3], static::$filterConditions, true)) {
                $cmp = $matches[3];
                $attribute = $matches[1];
            } else {
                $cmp = 'eq';
            }
            $query->andFilterWhere([$cmp, $attribute, $value]);
        }

        return $dataProvider;
    }
988754
public function search(array $params)
    {
        $query = CommentModel::find();

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'pagination' => [
                'pageSize' => $this->pageSize,
            ],
        ]);

        $dataProvider->setSort([
            'defaultOrder' => ['id' => SORT_DESC],
        ]);

        $this->load($params);

        if (!$this->validate()) {
            return $dataProvider;
        }

        $query->andFilterWhere([
            'id' => $this->id,
            'createdBy' => $this->createdBy,
            'status' => $this->status,
        ]);

        $query->andFilterWhere(['like', 'content', $this->content]);
        $query->andFilterWhere(['like', 'relatedTo', $this->relatedTo]);

        return $dataProvider;
    }
824030
public function search($params)
    {
        $query = Model::find();

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        $query->andFilterWhere([
            'menu_id' => $this->menuId,
        ]);

        $query->andFilterWhere(['like', 'menu', $this->menu]);

        return $dataProvider;
    }
176081
public function search($params)
    {
        $query = ShopAttribute::find();

        // add conditions that should always apply here

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        // grid filtering conditions
        $query->andFilterWhere([
            'id' => $this->id,
            'type_id' => $this->type_id,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
        ]);

        return $dataProvider;
    }
743258
public function search($params)
    {
        $query = Log::find();

        // add conditions that should always apply here

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        // grid filtering conditions
        $query->andFilterWhere([
            'id' => $this->id,
            'user_id' => $this->user_id,
            'created_at' => $this->created_at,
        ]);

        $query->andFilterWhere(['like', 'route', $this->route])
            ->andFilterWhere(['like', 'description', $this->description]);

        return $dataProvider;
    }
1008459
public function search(array $params): ArrayDataProvider
    {
        $authManager = Yii::$app->getAuthManager();

        if ($this->type == Item::TYPE_ROLE) {
            $items = $authManager->getRoles();
        } else {
            $items = array_filter($authManager->getPermissions(), function ($item) {
                return strpos($item->name, '/') !== 0;
            });
        }

        $query = new ArrayQuery($items);

        $this->load($params);

        if ($this->validate()) {
            $query->addCondition('name', $this->name ? "~{$this->name}" : null)
                ->addCondition('ruleName', $this->ruleName ? "~{$this->ruleName}" : null)
                ->addCondition('description', $this->description ? "~{$this->description}" : null);
        }

        return new ArrayDataProvider([
            'allModels' => $query->find(),
            'sort' => [
                'attributes' => ['name'],
            ],
            'pagination' => [
                'pageSize' => $this->pageSize,
            ],
        ]);
    }
1210507
public function search($params)
    {
        $query = SeoSlug::find();
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'sort' => [
                'defaultOrder' => ['id' => SORT_DESC],
            ],
        ]);
        $this->load($params);
        if (!$this->validate()) {
            return $dataProvider;
        }
        $query->andFilterWhere([
            SeoSlug::tableName() . '.model_id' => $this->model_id,
        ])->andFilterWhere(['LIKE', SeoSlug::tableName() . '.model', $this->model])
            ->andFilterWhere(['LIKE', SeoSlug::tableName() . '.slug', $this->slug]);
        return $dataProvider;
    }
313992
public function search($params)
    {
        $query = AuthRule::find();
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);
        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }
        $query->andFilterWhere([
                'created_at' => $this->created_at,
                'updated_at' => $this->updated_at,
            ]);
        $query->andFilterWhere(['like', 'name', $this->name])
            ->andFilterWhere(['like', 'data', $this->data]);
        return $dataProvider;
    }
1275112
public function search($params)
    {
        $query = QueueManager::find()->orderBy('id desc');

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        $query->andFilterWhere([
            'id' => $this->id,
            'ttr' => $this->ttr,
            'delay' => $this->delay,
            'priority' => $this->priority,
            'result_id' => $this->result_id,
//            'created_at' => $this->created_at,
//            'updated_at' => $this->updated_at,
            'start_execute' => $this->start_execute,
            'end_execute' => $this->end_execute,
        ]);

        $this->dayCondition($query, 'created_at');
        $this->dayCondition($query, 'updated_at');

        $query->andFilterWhere(['like', 'name', $this->name])
            ->andFilterWhere(['like', 'sender', $this->sender])
            ->andFilterWhere(['like', 'status', $this->status])
            ->andFilterWhere(['like', 'class', $this->class])
            ->andFilterWhere(['like', 'properties', $this->properties])
            ->andFilterWhere(['like', 'data', $this->data])
            ->andFilterWhere(['like', 'result', $this->result]);


        return $dataProvider;
    }
1100606
public function search($params)
    {
        $query = Language::find();

        // add conditions that should always apply here

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        // grid filtering conditions
        $query->andFilterWhere([
            'id' => $this->id,
            'iso_639_1' => $this->iso_639_1,
            'iso_639_2' => $this->iso_639_2,
            'iso_639_3' => $this->iso_639_3,
        ]);
        $query->andFilterWhere(['like', 'name', $this->name]);

        return $dataProvider;
    }
363949
public function search($params)
    {
        $query = Attachment::find();

        // add conditions that should always apply here

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        // grid filtering conditions
        $query->andFilterWhere([
            'id' => $this->id,
            'user_id' => $this->user_id,
            'size' => $this->size,
            'created_at' => $this->created_at,
        ]);

        $query->andFilterWhere(['like', 'filename', $this->filename])
            ->andFilterWhere(['like', 'original_name', $this->original_name])
            ->andFilterWhere(['like', 'type', $this->type])
            ->andFilterWhere(['like', 'path', $this->path])
            ->andFilterWhere(['like', 'ip', $this->ip]);

        return $dataProvider;
    }
79216
public function search($params)
    {
        $query = Order::find();

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        $query->andFilterWhere([
            'id' => $this->id,
            'ref_by' => $this->ref_by,
            'created_by' => $this->created_by,
            'updated_by' => $this->updated_by,
        ]);

        $query->andFilterWhere(['like', 'status', $this->status])
            ->andFilterWhere(['like', 'payment_method', $this->payment_method])
            ->andFilterWhere(['like', 'note', $this->note])
            ->andFilterWhere(['like', 'include_vat', $this->include_vat])
            ->andFilterWhere(['like', 'customer_username', $this->customer_username])
            ->andFilterWhere(['like', 'customer_phone', $this->customer_phone])
            ->andFilterWhere(['like', 'customer_name', $this->customer_name])
            ->andFilterWhere(['like', 'customer_email', $this->customer_email])
            ->andFilterWhere(['like', 'customer_address', $this->customer_address])
            ->andFilterWhere(['like', 'customer_company', $this->customer_company])
            ->andFilterWhere(['like', 'customer_area', $this->customer_area])
            ->andFilterWhere(['like', 'customer_tax_number', $this->customer_tax_number])
            ->andFilterWhere(['like', 'real_value', $this->real_value])
            ->andFilterWhere(['like', 'discount_value', $this->discount_value])
            ->andFilterWhere(['like', 'total_price', $this->total_price])
            ->andFilterWhere(['like', 'created_at', $this->created_at])
            ->andFilterWhere(['like', 'updated_at', $this->created_at]);

        return $dataProvider;
    }
954750
public function search($params)
    {
        $query = Language::find();

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        $query->andFilterWhere([
            'status' => $this->status,
        ]);

        $query->andFilterWhere($this->createLikeExpression('language_id', $this->language_id))
            ->andFilterWhere($this->createLikeExpression('language', $this->language))
            ->andFilterWhere($this->createLikeExpression('country', $this->country))
            ->andFilterWhere($this->createLikeExpression('name', $this->name))
            ->andFilterWhere($this->createLikeExpression('name_ascii', $this->name_ascii));

        return $dataProvider;
    }
624371
public function searchForMods($params)
    {
        $query = static::find();

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'pagination' => [
                'defaultPageSize' => 10,
                'forcePageParam' => false
            ],
        ]);

        $dataProvider->sort->defaultOrder = ['name' => SORT_ASC];

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        $query->andFilterWhere(['name' => $this->name]);

        return $dataProvider;
    }
384103
public function search($params)
    {
        $query = FavoriteProduct::find()->where(['user_id' => \Yii::$app->user->id]);

        // add conditions that should always apply here

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        // grid filtering conditions
        $query->andFilterWhere([
            'id' => $this->id,
            'product_id' => $this->product_id,
            'user_id' => $this->user_id,
        ]);

        return $dataProvider;
    }
986366
public function search($params)
    {
        $query = Country::find()->active();

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        $query->andFilterWhere([
            'id' => $this->id,
          	'is_active' => $this->is_active,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
            'country_id' => $this->country_id,
        ]);

        $query->andFilterWhere(['like', 'iso2', $this->iso2])
            ->andFilterWhere(['like', 'iso3', $this->iso3])
          	->andFilterWhere(['like', 'name', $this->name]);

        return $dataProvider;
    }
1138281
public function search($params)
    {
        $query = WarehouseProduct::find();

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        $query->andFilterWhere([
            'id' => $this->id,
            'name' => $this->name,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
            'created_by' => $this->created_by,
            'updated_by' => $this->updated_by,
        ]);

        $query->andFilterWhere(['like', 'feature_img', $this->feature_img])
            ->andFilterWhere(['like', 'sku', $this->sku])
            ->andFilterWhere(['like', 'description', $this->description]);

        return $dataProvider;
    }