F
Filamentβ€’9mo 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β€’9mo 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
Altffenserβ€’9mo ago
Works! thank you πŸ˜„
Want results from more Discord servers?
Add your server
More Posts
How can I work around this `column reference "id" is ambiguous`?```php // GradeResource.php public static function getEloquentQuery(): Builder { $query = parenHow can load an external video from Youtube, Vimeo?Hello guys, I want add an input in my form and save a link from youtube, vimeo or another site, how Inject Model in Livewire ComponentI'm trying to inject my campaign model in a livewire component through form. I tried the instructionshow hidden fields conditionaly not workingas title says ```php Forms\Components\Checkbox::make('availability')->default(true), Forms\Componenhello. I have this problem when creating a category from the admin panel. I did everything well. buhello. I have this problem when creating a category from the admin panel. I did everything well. butHow to dynamically name uploaded images based on the number of images.Hello, In my V2 project I'm trying to upload images by giving name dynamically based on the number Table tabs from databaseI looked at the demo application and see the below tab on the table but instead of passing static vaSorting repeatableEntryIs it possible to sort a repeatableEntry in an Infolist using data from a relationship? I would likeHow i can update the form when change value ?Hi, I have a RelationManager and in form i have this code : How to update the form repeater with vSelect::isOptionDisabled(): Argument #2 ($label) must be of type stringI'm getting the following error when trying to create or edit a EmailResource ``` Filament\Forms\C