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
->getStateUsing(fn ($state) => '#'.$state)yeah i tried but gives me 500 error
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)i love u that was it!!!