Laravel 5.2 whereBetween not working

2019-09-09 23:57发布

I am using laravel 5.2 framework but in this WhereBetween not working. I am using price range where price starts form 500 to 4000. When I execute the query get empty records but when I remove WhereBetween() then get all records. Please suggest me how to solved this.

$query = Property::query();
        $query->select('properties.property_id', 'properties.property_title', 'properties.description', 'properties.latitude', 'properties.longitude', 'properties.city_name', 'properties.state_name');
        $query->leftjoin('properties_base_season_price_transactions', 'properties_base_season_price_transactions.parent_id', '=', 'properties.property_id');
        $query->leftjoin('properties_availability', 'properties_availability.property_id', '=', 'properties.property_id');
        $query->where('properties.property_category_id', $post_data['categoryid']);
        $query->where('properties.property_sub_category_id', $post_data['subcategoryid']);
        $query->where('properties.city_name',  'LIKE' , '%'.$post_data['city'].'%');
        $query->whereBetween('properties_base_season_price_transactions.price', [500, 4444]);
        $query_output = $query->get()->toArray();

1条回答
聊天终结者
2楼-- · 2019-09-10 00:29

There seems to something wrong with whereBetween try

->whereRaw("properties_base_season_price_transactions.price BETWEEN 500 AND 4444");
查看更多
登录 后发表回答