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