Can you explain please, you have for example a table with addresses and you want to sort them according to the city name ?
Mar 11, 2022
4
Level 3
Sorting on "Has one" relation column
Hello,
I have a users and address table. Which is a 1:1 relationship.
So in Nova, I want to make a column 'city' which should be sortable.
Text::make('City', 'address.city')->sortable();
The cities are displayed, but when trying to sort the column by city, it says address.city column is not found. How do I make this sortable?
Cheers
Level 3
@wingly That makes sense. But how would that work on the 'edit' page of the resource? Will I be able to change the city there with this 1:1 relation setup?
Would putting everything in the main table be a better solution?
1 like
Please or to participate in this conversation.