Sorting a custom attribute

How would one add a sortable() column that is pointing to an attribute of a model?

It shows up fine, but throws an error on sort because the column doesn't exist.

As a contrived example:

Say I have a "Company" model, which hasMany "CompanyClient"s.

On the "Company", there is an attribute called "has_company_clients" which is a boolean. The Filament IconColumn is used to show whether the company has clients or not. I want this column to be sortable
Was this page helpful?