Hi!
Trying to add a tooltip to a (table) TextColumn.
1. My Enum looks like this:
<?php
namespace App\Enums;
use ...
use ...
use ...
enum TicketPriority: string implements HasLabel, HasColor, HasIcon
{
case Low = 'low';
case Medium = 'medium';
case High = 'high';
case Urgent = 'urgent';
.....
public function getTooltip(): ?string
{
return match ($this) {
self::Low => ('Longer description 1 here ....'),
self::Medium => ('Longer description 2 here ....'),
self::High => ('Longer description 3 here ....'),
self::Urgent => ('Longer description 4 here ....'),
};
}
....
2. On my resource im trying to get:
...
IconColumn::make('priority')
->label('') //-narrower column
->icon(fn($state) => $state->getIcon()) //-Picks and shows the icon
->size(IconColumnSize::Medium)
->tooltip(fn($state) => $state->getTooltip()),
...
3. I get the following error:
Call to a member function getTooltip() on null . The same for getLabel() ....
4. However, if I do something like this:
...
IconColumn::make('priority')
->label('')
->icon(fn($state) => $state->getIcon())
->size(IconColumnSize::Medium)
->tooltip(fn($state) => dd($state->getTooltip())), <------------
ˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆ
...
5. I actually get:
"Longer description 1 here ...." // app/Filament/Resources/TicketResource.php:116
6. What am I missing??
Thanks!!!!