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
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
1 Reply
Dan Harrin
Dan Harrin2y ago
what do you mean by optional relationship the error suggests its using the wrong table to find the column on
Want results from more Discord servers?
Add your server