How to use defaultSort as orderByRaw?
Hi, just want to ask how to achieve a defaultSort with a certain
status
like invited, active, revoked
etc. I have achieve this behavior using protected function getTableQuery(): Builder
but my problem is that whenever I have ->sortable()
in my columns it remains the sorting as invited, active, revoked etc
and the only changing is how the rows sorted but the sorting overall is same with the arrangment of status.![No description](https://answer-overflow-discord-attachments.s3.amazonaws.com/1152847095829626962/snippet.png)
![No description](https://answer-overflow-discord-attachments.s3.amazonaws.com/1152847096219701298/snippet_1.png)
2 Replies
I think this could be a good use-case for a computed column with
virtualAs()
:
https://pineco.de/using-computed-columns-in-laravel/table