- Laravel Version: 5.1.45
- PHP Version: 5.6
- Database Driver & Version:Mysql
Description:
Pagination fails on adding column alias and having condition on alias due to the count query that is run without the select query.
Steps To Reproduce:
$data = PropertyRent::select(DB::raw('min(rent) as min_rent,property_id'))->groupBy('property_id')->having('min_rent','>=',1000)->paginate();
Error:
Unknown column 'min_rent' in 'having clause' (SQL: select count(*) as aggregate from property_rents group by condominium_id having min_rent >= 1000)'
Note: the get() query works fine.