php - Yii2如何在搜索模型中添加价格范围过滤器
问题描述
我在 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,
]);
我怎样才能做到这一点
解决方案
I just done like this
$query->andFilterWhere(['between','price',$this->price_start,$this->price_end])
推荐阅读
- azure - 未从 Azure 数据工厂中的 Azure 表存储源加载所有列
- javascript - 迭代中的 StaleElementReferenceError
- javascript - 我想使用 js 和 ajax 调用将来自 DB 的多个复选框数据发送到 spring 控制器
- webhooks - 如何使用 HMACSHA256 python 3 验证 Xero webhook 有效负载
- exception - System.IO.FileLoadException:在 RichEditBox 文档中引发异常
- c# - 如何在 Azure Devops 中使用服务帐户模拟用户
- json - 使用 jq 命令行处理器时 JSON 格式的问题
- sql - 偏移量不适用于 Count(*) 作为 order by
- javascript - 从上传的图片生成 DataURI 并添加到 PDF (JsPDF)
- docker - 什么是 Docker 中的悬空图像/它们如何创建/如何删除它们