How can I sort by value string on table?
TextColumn::make('source')->sortable(query: fn (Builder $query, string $direction) => $query
->orderByRaw(<<<SQL
CASE WHEN source = 'A' THEN 1 ELSE 0 END {$direction}, source {$direction}
SQL)
),
Here is my current code, I am trying to prioritise or order the table so it's by sourced and the given value that equals source must be first then the rest. Nothing is working so far, I've tried multiple ways. Please help. TIA
0 Replies