Sortable relation...
Hello everyone!
This works:
This obviously does not work:
full_name
is a combination of lastname
and firstname
.
How should I proceed? Should I create a scope since it's in a relationship?
Any help? Thanks in advance!4 Replies
Sounds like you need a virtual column. It’s somewhere in the docs. Sorry I don’t have a link at the moment.
Yes, I've seen this solution, but I would prefer to first filter by last name and then by first name. Thank you for your response.
Well, based on what your shared you don’t have a first or last name column. So it would have to be a virtual column.
Actually, I don't know what got into me... I was foolish. All I needed to do was:
Tables\Columns\TextColumn::make('user.full_name')
->sortable(['firstname', 'lastname'])
Thank you 🙂