$query, ] ); $this->load($params); // VarDumper::dump($params, 10, true); die(); 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; } if (!empty( $this->sku )) { $query->innerJoinWith('products.productVariant') ->andWhere( [ 'product_variant.id' => $this->sku, ] ); } // grid filtering conditions $query->andFilterWhere( [ 'id' => $this->id, ] ); $query->andFilterWhere( [ 'like', 'name', $this->name, ] ); $query->andFilterWhere( [ 'like', 'email', $this->email, ] ); $query->andFilterWhere( [ 'like', 'phone', $this->phone, ] ); $query->andFilterWhere( [ 'like', 'body', $this->body, ] ); $query->andFilterWhere( [ 'like', 'consignment', $this->consignment, ] ); $query->andFilterWhere( [ 'like', 'declaration', $this->declaration, ] ); $query->andFilterWhere( [ 'label' => $this->label, ] ); $query->andFilterWhere( [ 'manager_id' => $this->manager_id, ] ); $query->andFilterWhere( [ 'delivery' => $this->delivery, ] ); if (!empty( $this->date_range )) { $this->date_from = strtotime(explode('to', $this->date_range)[ 0 ]); $this->date_to = strtotime(explode('to', $this->date_range)[ 1 ]); $query->andFilterWhere( [ '>=', 'created_at', $this->date_from, ] ); $query->andFilterWhere( [ '<=', 'created_at', $this->date_to, ] ); } return $dataProvider; } }