Custom value of textcolumn description
Can I get a value on db column and put it in the table description method? if so, how can I achieve it?
And can I also show multiple column data in a single table text column? I want to show all of my boolean true in a single table column. (More like a tags)
5 Replies
The description method accepts a callback where you can inject the record for the current row so you can use something like this:
How about multiple raws?
Use formatStateUsing and inject the record to that function, then you can just use your own logic to combine them. You could also make a custom column if it was more complex than that
There is a lot of methods that accept callbacks, any of those callbacks use the same evaluate function under the hood which allows you to inject all kinds of helpful variables to use in your own logic https://filamentphp.com/docs/3.x/tables/columns/advanced#injecting-the-current-eloquent-record
I might well look into it, thanks for the idea!
If you could give me more insight about this. I was just trying
->formatStateUsing(fn ($record) => $record->is_admin && $record->has_access)
to try it out but it seems that it is not displaying into the table column.