Yii2如何在搜索模型中添加价格区间过滤器

atmip9wb  于 2022-11-09  发布在  其他
关注(0)|答案(1)|浏览(116)

我已经在yii2中创建了一个搜索模型。我想在其中添加一个价格起始和价格终止文本字段以及过滤条件。现在过滤选项如下

$query->andFilterWhere([
            'id' => $this->id,
            'city_id' => $this->city_id,
            'price' => $this->price, <====Here i want to add price range
            'age_id' => $this->age_id,
            'usage_id' => $this->usage_id,
            'condition_id' => $this->condition_id,
            'seller_type_id' => $this->seller_type_id,
            'warranty_id' => $this->warranty_id,
            'flag' => $this->flag,
        ]);

我该怎么做

o0lyfsai

o0lyfsai1#

我就这样做了

$query->andFilterWhere(['between','price',$this->price_start,$this->price_end])

相关问题