F
Filamentβ€’6mo 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β€’6mo 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β€’6mo ago
You can inject the query in ->defaultSort() though πŸ€”
->defaultSort(function (Builder $query) {
//
})
->defaultSort(function (Builder $query) {
//
})
Vp
Vpβ€’6mo ago
Oh, now i remember that it accept closure as well.. then may achieve using like this
toeknee
toekneeOPβ€’6mo ago
ahhh legend!
Want results from more Discord servers?
Add your server