ColorColumn problem with hexadecimal value

i have this column in a table: ColorColumn::make('priority_value') ->label('Prioridad') ->sortable() ->toggleable(), but in my database i have 000000 without the "#" how can i add the "#" so the colorColumn can understand the color value? i tried using this: ->getStateUsing(fn (string $state): string => '#' . ltrim($state, '#')) but gets me 500 error
4 Replies
Dennis Koch
Dennis Koch2mo ago
->getStateUsing(fn ($state) => '#'.$state)
ζ͜͡Gurthang
ζ͜͡GurthangOP2mo ago
yeah i tried but gives me 500 error
Dennis Koch
Dennis Koch2mo ago
What's the error message? Oh, sorry. I didn't read the last sentence 🙈 Probably this, because there is no state in getStateUsing: ->getStateUsing(fn ($record) => '#'.$record->priority_value)
ζ͜͡Gurthang
ζ͜͡GurthangOP2mo ago
i love u that was it!!!

Did you find this page helpful?