Apr 18, 2024
0
Level 5
Add Value To Input Filament
Hi , i have payment resource with first and last name but when i go to edit the record the full_name comes empty i tried to add ->default method but still empty
Forms\Components\TextInput::make('first_name')
->label(__('first_name'))
->maxLength(255)
->live()
->afterStateUpdated(fn (Forms\Set $set , ?string $state) => $set('full_name', $state)),
Forms\Components\TextInput::make('last_name')
->label(__('last_name'))
->maxLength(255)
->live()
->afterStateUpdated(fn (Forms\Set $set , ?string $state) => $set('full_name', $state)),
Forms\Components\TextInput::make('full_name')
->label(__('full_name'))
->readOnly()
->maxLength(255),
And here's the full_name
#Customer Model
public function fullName():Attribute
{
return Attribute::make(
get: fn() => $this->firstname . ' ' . $this->lastname,
);
}
Please or to participate in this conversation.