F
Filament11mo ago
ahinkle

Set Global Form Input Label as `Str::headline()`?

In all of my inputs, I find myself overriding the label: Billing first name -> Billing First Name Is there way to override the default setting label to always use Str::headline()? Either in a App Service Provider or service container?
TextInput::make('billing_first_name')
->label('Billing First Name')
TextInput::make('billing_first_name')
->label('Billing First Name')
Tried to do something fun like this but no dice:
TextInput::macro('label', function (string $label): static {
return parent::label(Str::headline($label));
});
TextInput::macro('label', function (string $label): static {
return parent::label(Str::headline($label));
});
2 Replies
ahinkle
ahinkleOP11mo ago
Perfect thank you
TextInput::configureUsing(function (TextInput $input) {
$input->label(Str::headline($input->getLabel()));
});
TextInput::configureUsing(function (TextInput $input) {
$input->label(Str::headline($input->getLabel()));
});
Want results from more Discord servers?
Add your server