简体   繁体   中英

Laravel 5.2 whereBetween not working

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();

whereBetween尝试似乎有问题

->whereRaw("properties_base_season_price_transactions.price BETWEEN 500 AND 4444");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM