ucwords all field values

A lot of my database content is stored lowercase. Is it possible to add something (maybe to AdminPanelProvider::boot() to make all values have ucwords applied to them?
Solution:
formatStateUsing instead of dehydrateStateUsing? ```php TextColumn::configureUsing(function (TextColumn $column) { $column->formatStateUsing(function ($state) {...
Jump to solution
7 Replies
LeandroFerreira
Eloquent: Mutators & Casting - Laravel 12.x - The PHP Framework For...
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
keiron
keironOP5w ago
I'm specifically looking for a way to override the settings of the display class in AdminPanelProvider::boot(). Something that would look like this (which does not work): TextColumn::configureUsing(function (TextColumn $component) { $component->dehydrateStateUsing( fn ($state) => $state ? Str::of($state)->title() : null ); });
Solution
LeandroFerreira
formatStateUsing instead of dehydrateStateUsing?
TextColumn::configureUsing(function (TextColumn $column) {
$column->formatStateUsing(function ($state) {
return Str::of($state)->title();
});
});
TextColumn::configureUsing(function (TextColumn $column) {
$column->formatStateUsing(function ($state) {
return Str::of($state)->title();
});
});
toeknee
toeknee5w ago
You could always just add a CSS class to the column with extraAttributes and text-upper ?
keiron
keironOP4w ago
It doesn't look like TextColumn::configureUsing() is called at all
LeandroFerreira
for example? you mean, it sometimes work?
keiron
keironOP4w ago
Sorry, I was being silly. I was using TextColumn when I should have been using TextEntry. I am new to Filament. This works: TextEntry::configureUsing(function (TextEntry $column) { $column->formatStateUsing(function ($state) { return Str::of($state)->title(); }); }); Thank you 👌

Did you find this page helpful?