Flats::query()->where('category_id', 1)
->related('prices')
->related('photos')
->related('stations')
->related('stations.from_station_list')
->relted('district')
->related('city')
->order_by('created_at', 'desc');
->limit($pagination->per_page)
->offset($pagination->offset)
->get();
SELECT
`t0`.`id` AS `t0_c0`,
...
...
...
...
...
`t6`.`shortname_pos` AS `t6_c11`
FROM
(
SELECT
`t0`.`id`,
...
...
...
...
`t0`.`created_at`
FROM `flats` AS `t0`
WHERE `t0`.`category_id` = 1
LIMIT 10
OFFSET 0
) AS `t0`
LEFT JOIN `prices` AS `t1` ON (`t0`.`id` = `t1`.`ad_id`)
LEFT JOIN `photos` AS `t2` ON (`t0`.`id` = `t2`.`ad_id`)
LEFT JOIN `stations` AS `t3` ON (`t0`.`id` = `t3`.`ad_id`)
LEFT JOIN `stations_list` AS `t4` ON (`t3`.`station_id` = `t4`.`id`)
LEFT JOIN `districts_list` AS `t5` ON (`t0`.`district_id` = `t5`.`id`)
LEFT JOIN `fias` AS `t6` ON (`t0`.`city_id` = `t6`.`id`)
ORDER BY `t0`.`created_at` DESC;
$query = Sale::query()
->where('category_id', 1)
->where('status', 1);
->and_where_open()
->where('rooms_count', 1)
->or_where('rooms_count', 2)
->or_where('rooms_count', 3)
->and_where_close()
->related('stations')
->related('photos')
->get();
It looks like you're new here. If you want to get involved, click one of these buttons!