Open tiagofrancafernandes opened 6 months ago
Allow
\Guava\FilamentIconPicker\Tables\IconColumn::make('icon')
// Hide programmatically
->hideIcon(fn(?Model $record) => !$record?->icon)
// Set manually an icon
->useIcon('feathericon-tag') // string
->useIcon(fn(?Model $record) => $record?->icon) // Closure
->useIcon(fn(?Model $record) => $record?->icon ?? 'feathericon-tag') // With alter/default value
// Note: In the future, maybe create a default icon method if it has no value in the 'state'
In blade:
+@if (!$toHideIcon())
<div class="filament-icon-picker-icon-column px-4 py-3">
- <x-icon class="h-6" name="{{$getState()}}" />
+ <x-icon class="h-6" name="{{$getIcon()}}" />
</div>
+@endif
On branch fix/check-state-before-load-icon modified: resources/views/tables/icon-column.blade.php modified: src/Tables/IconColumn.php