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:Jump to solution
formatStateUsing
instead of dehydrateStateUsing?
```php
TextColumn::configureUsing(function (TextColumn $column) {
$column->formatStateUsing(function ($state) {...7 Replies
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.
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
formatStateUsing
instead of dehydrateStateUsing?
You could always just add a CSS class to the column with extraAttributes and text-upper ?
It doesn't look like TextColumn::configureUsing() is called at all
for example?
you mean, it sometimes work?
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 👌