F
Filamentβ€’3w ago
toeknee

RelationshipManager Table Ordering

Is there a method I am missing, to allow sorting the table by an order of a relationships relationship? For example, we have a resource showing a list of rows, which then shows data from a relationship, then shows more data from that relationships relationship and I want to order by the order column in the end relaitonship so: Items -> Sub Item -> sub data.order
Solution:
You can inject the query in ->defaultSort() though πŸ€” ```php ->defaultSort(function (Builder $query) { // ...
Jump to solution
4 Replies
Vp
Vpβ€’3w ago
IIRC ->defaultSort('realtion.anotherRelation') will not work, but what about ->modifyQueryUsing() and return data based on sort order provided (didn't check, don't know whether it should work or not tho πŸ˜† )
Solution
dissto
disstoβ€’3w ago
You can inject the query in ->defaultSort() though πŸ€”
->defaultSort(function (Builder $query) {
//
})
->defaultSort(function (Builder $query) {
//
})
Vp
Vpβ€’3w ago
Oh, now i remember that it accept closure as well.. then may achieve using like this
toeknee
toekneeβ€’3w ago
ahhh legend!