get query from ListRecords\Tab within Badge() to show the actual count() of filtered query

I'm talking about this: https://filamentphp.com/docs/3.x/panels/resources/listing-records#adding-badges-to-filter-tabs in the example above, this could be quite useful for showing the number of records that pass that filter. I'm using the method modifyQueryUsing() to filter the records for every Tab, but how can I access the query to apply the count() eloquent method to display number of records within the Badge() method without manually writing the query again?
2 Replies
developer
developerOP2y ago
what i'm trying to do: ->badge( fn (Builder $query) => $query->count() ) but it doesn't work
Antoine
Antoine2y ago
Anyone have a solution? It seems a bug, it's blocked to 1 for me

Did you find this page helpful?