Table optional relationship and sorting

Table is Units, field is TextColumn::make('floorplans.bedroom_size')->sortable();. Right now when I try to sort, Im getting SQLSTATE[42S22]: Column not found: 1054 Unknown column 'bedroom_size' in 'field list' with
select * from `units` where (`archived` is null) and `units`.`tenant_id` = 1 order by (select `bedroom_size` from `floorplans` where `units`.`floorplan_id` = `floorplans`.`id` and `floorplans`.`deleted_at` is null) asc limit 10 offset 0
Was this page helpful?