How to sort the table using model accessor

I don't think you can do this. Use a callback instead

TextColumn::make('full_name')
    ->sortable(query: function (Builder $query, string $direction): Builder {
        return $query
            ->orderBy('last_name', $direction)
            ->orderBy('first_name', $direction);
    })

https://filamentphp.com/docs/3.x/tables/columns/getting-started#sorting
Was this page helpful?