F
Filament5w ago
Pscl

Showing icons in Table Column Badge

Hey all,
Tables\Columns\TextColumn::make('types.name')->badge()->icon('types.icon')
Tables\Columns\TextColumn::make('types.name')->badge()->icon('types.icon')
Iam trying to accomplish this. As my types are stored in database and not as enum, how can I add icon within the badge that loads the icon from icon column in types table? Thanks!
7 Replies
Pscl
Pscl5w ago
Yes, but state does not have the relation item. It has the full relation.
umardi_
umardi_4w ago
how about use $record instead? not $state, get relationship manually, something like $record->types
LeandroFerreira
->icons(fn(YourModel $record) => $record->types->pluck('name', 'icon'))
->icons(fn(YourModel $record) => $record->types->pluck('name', 'icon'))
?
Pscl
Pscl4w ago
@Leandro Ferreira thanks. Did you test it? Somehow for me icons are not showing up.
LeandroFerreira
are you using heroicons?
Pscl
Pscl4w ago
worked! I had an issue. Thanks!
Want results from more Discord servers?
Add your server
More Posts
Dashboard responsive columns not working as I expectedThis is my custom dashboard code ```php class UserDashboard extends Dashboard { public functioUnderstanding FilamentAs a recent convert to Laravel, the range of projects can be a little overwhelming, especially when How do we overwrite all resource pages?I'm trying to change how the heading works across all pages without editing them all. Tried using maUnable to use tabs in listview. trim(): Argument #1 ($string) must be of type string, Filament\Suppo```php class ListAppointments extends ListRecords { protected static string $resource = AppointmafterStateUpdated results in unpredictable resultStraight from Filament docs, i am trying to use afterStateUpdated to generate a Slug for the field. Sum summarizer not respecting MoneyCast in table outputI'm following along with the 'Getting Started' tutorial and trying out table summaries but seem to hResource StructureHi all. Just wondered what the best way to approach this would be: I am going to have a number of rHide all records in the tableHi, I have a question: how can I hide all records in the table as long as a filter option is not selmutateFormDataBeforeCreate not running on create from Relation ManagerI have a Filament resource and in its Create page I implemented the mutateFormDataBeforeCreate methoIs Filament adequate for any type of web app? Or is it more focused on admin panels?Total newbie here. Sorry if this is not the correct place to ask this. I couldn't find a similar que