F
Filamentβ€’13mo ago
Altffenser

Include prefix as part of text input.

How can I do to include the prefix on TextInput for saving in database? My code:
TextInput::make('title')
->name('title')
->helperText(new HtmlString('Please <b style="color:red">do not</b> include the word indicating the type of event selected, it will be added automatically.'))
->label('Event title')
->prefix(function (Get $get): string {
return Event\Type::find($get('event_type_id'))->name ?? '';
})
TextInput::make('title')
->name('title')
->helperText(new HtmlString('Please <b style="color:red">do not</b> include the word indicating the type of event selected, it will be added automatically.'))
->label('Event title')
->prefix(function (Get $get): string {
return Event\Type::find($get('event_type_id'))->name ?? '';
})
I always thought it was included but it is not. Thank you for help. 😊
Solution:
->dehydrateStateUsing(
fn (Get $get, string $state) => Event\Type::find($get('event_type_id'))->name) . $state
)
->dehydrateStateUsing(
fn (Get $get, string $state) => Event\Type::find($get('event_type_id'))->name) . $state
)
...
Jump to solution
2 Replies
Solution
Saade
Saadeβ€’13mo ago
->dehydrateStateUsing(
fn (Get $get, string $state) => Event\Type::find($get('event_type_id'))->name) . $state
)
->dehydrateStateUsing(
fn (Get $get, string $state) => Event\Type::find($get('event_type_id'))->name) . $state
)
Altffenser
AltffenserOPβ€’13mo ago
Works! thank you πŸ˜„
Want results from more Discord servers?
Add your server