Spatie tags filter
I am using Spatie tags in a resource, but if I am making a filter, it lists the available tags as {"en":"MyTag"}.
Here's the code:
This was working fine in Filament v2.
Probably there is a simple solution for this, but I could not figure it out.
24 Replies
Hello ! Did you find the solution?
thanks
Not yet 😢
😫
in v2 its work
nobody report, if i find a solution i comment here
thanks
i delete this !! its work
Delete it from where? I did not overwrite getTagClassName
I have Product.php (model)
i add this code, i deleted and run
if you want , share your code
I just have a Contacts model:
And this is the filter
And I don't have a tags() relationship, this should be handled automatically by the Spatie Tags plugin
Works OK in the form, the problem is only in filters
Do yo use SpatieTagInput on filters?
No, just SelectFilter
This used to work in v2
Question: if you choose one of those displayed filters, does it correctly perform the filtering? ie: is it just a display issue? or is the underlying query also not updating the table data?
Oh, and is the filter-indicator displayed as well?
Oh, and is the filter-indicator displayed as well?
Yes, the filtering is performed correctly, but the indicator is wrong
add this to your
SelectFilter
: ->getOptionLabelFromRecordUsing(fn($record) => $record['name'] )
THanks, this is working. Kinda. The filter indicator is still broken.
could you send me a code of your filter indicator?
I don't have an indicator set up.
THis is my code:
If I set an indicator, I don't have access to the $record, I get only the $data array which returns the id of the tag
Of course I could make an extra query, but this was working fine in v2
I think I will submit a bug report
Try $record->name. Translations in the spatie package only work when the attribute is called directly off the model. So $record[‘name’] won’t automatically translate.
I ran into these same issues today. @swajp @Watoka @awcodes
This is what I'm doing to show the indicator: